Skip to main content

Python package to solve the job shop scheduling problem with Gantt chart as output

Project description

PyJackson : Python Job Shop Scheduling Module

Job Shop Scheduling Problem (JSS) with Jackson's Algorithm solving using Python >= 3.6.

Build status Python Version Pre-commit License

Implementation of a mathematical model in Python to solve an assignment problem in Job Shop environments. With its respective Gantt chart. A job shop consists of a set of distinct machines that process jobs. Each job is a series of tasks that require use of particular machines for known durations, and which must be completed in specified order. The job shop scheduling problem is to schedule the jobs on the machines to minimize the time necessary to process all jobs (i.e, the makespan) or some other metric of productivity. Job shop scheduling is one of the classic problems in Operations Research.

Very first steps

First of all, you need to install a few dependencies.

pip install reportlab
  • numpy : for matrix operations.
pip install numpy
  • pandas : for data manipulating.
pip install pandas
pip install matplotlib

🚀 Features

  • Worked with multiple data formats: CSV, JSON and TEXT files.
  • Plotting Gantt Chart for each solution found for all sub-problems(Virtual).
  • Generate a PDF file with the Gantt Charts for each solution found for all sub-problems(Virtual) and the optimal solution as well.

Installation

pip install PyJacksonAlgo==0.1.0

Usage

from jacksonpy import JacksonAlgo

########################## Example using text file ##########################

# Reading and manipulating data
data_path = "YOUR_PATH/input.txt"  # path to the data file
d = JacksonAlgo.Data(data_path)  # create a Data object with the path to the data file
data = (
    d.get_job_durations()
)  # get the durations: list of list of integers [[J1, dur1, dur2, dur3], [J2, dur1, dur2, dur3] ...]

# Solving the problem
al = JacksonAlgo.JackAlgo(data)  # create a JackAlgo object with the data

print(al)  # print the problem details

preparedData = al.prepareData()  # prepare the data for the algorithm
cmaxVirtual, _, __ = al.get_cmax_virtual(
    preparedData
)  # get the cmaxVirtual result of the virtual sub-problems
result = al.solve(
    cmaxVirtual
)  # solve the problem and save the result in the result variable
al.generate_pdf_file(
    results=result
)  # generate a pdf file with the result of the problem


########################## Example using Json file ##########################

# Reading and manipulating data
data_path = "YOUR_PATH//input.json"  # path to the data file
d = JacksonAlgo.Data(data_path)  # create a Data object with the path to the data file
data = (
    d.get_job_durations()
)  # get the durations: list of list of integers [[J1, dur1, dur2, dur3], [J2, dur1, dur2, dur3] ...]
print(data)  # print the data

# Solving the problem
al = JacksonAlgo.JackAlgo(data)  # create a JackAlgo object with the data

print(al)  # print the problem details

preparedData = al.prepareData()  # prepare the data for the algorithm
cmaxVirtual, _, __ = al.get_cmax_virtual(
    preparedData
)  # get the cmaxVirtual result of the virtual sub-problems
result = al.solve(
    cmaxVirtual
)  # solve the problem and save the result in the result variable
al.generate_pdf_file(
    results=result
)  # generate a pdf file with the result of the problem

########################## Example using 2d array ##########################

# Reading and manipulating data (defined as a lis of lists of integers)
data = [
    [1, 7, 5, 6, 9, 10],
    [2, 4, 6, 5, 8, 1],
    [3, 8, 2, 4, 3, 7],
    [4, 6, 3, 9, 7, 5],
    [5, 5, 7, 3, 5, 9],
]  # list of list of integers [[J1, dur1, dur2, dur3], [J2, dur1, dur2, dur3] ...]

# Solving the problem
al = JacksonAlgo.JackAlgo(data)  # create a JackAlgo object with the data

print(al)  # print the problem details

preparedData = al.prepareData()  # prepare the data for the algorithm
cmaxVirtual, _, __ = al.get_cmax_virtual(
    preparedData
)  # get the cmaxVirtual result of the virtual sub-problems
result = al.solve(
    cmaxVirtual
)  # solve the problem and save the result in the result variable
al.generate_pdf_file(
    results=result
)  # generate a pdf file with the result of the problem

########################## Example using dictionary ##########################

# Reading and manipulating data (defined as a lis of lists of integers)
data = {
    "Task 1": [3, 4, 6, 5],
    "Task 2": [2, 3, 6, 9],
    "Task 3": [8, 9, 2, 6],
    "Task 4": [7, 6, 3, 2],
    "Task 5": [3, 6, 4, 5],
    "Task 6": [5, 8, 7, 9],
}  # dictionary of lists of integers {'Task 1': [3, 4, 6, 5], 'Task 2': [2, 3, 6, 9], ...}

# Solving the problem
al = JacksonAlgo.JackAlgo(data)  # create a JackAlgo object with the data

print(al)  # print the problem details

preparedData = al.prepareData()  # prepare the data for the algorithm
cmaxVirtual, _, __ = al.get_cmax_virtual(
    preparedData
)  # get the cmaxVirtual result of the virtual sub-problems
result = al.solve(
    cmaxVirtual
)  # solve the problem and save the result in the result variable
al.generate_pdf_file(
    results=result
)  # generate a pdf file with the result of the problem

Results

  • Gantt Chart for the optimal solution:
  • PDF file with the Gantt Charts for each solution found for all sub-problems(Virtual):

    Please download the PDF to view it: Download PDF.

🛡 License

License

This project is licensed under the terms of the GNU GPL v3.0 license. See LICENSE for more details.

📃 Citation

@misc{PyJackson,
  author = {Saraei Thamer},
  title = {Implementation of a mathematical model in Python to solve an assignment problem in Job Shop environments. With its respective Gantt chart.},
  Github = {th-rpy},
  year = {2022},
  howpublished = {\url{https://github.com/th-rpy/jackson_job_shop_scheduling}}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyJacksonAlgo-0.1.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

PyJacksonAlgo-0.1.1-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file PyJacksonAlgo-0.1.1.tar.gz.

File metadata

  • Download URL: PyJacksonAlgo-0.1.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for PyJacksonAlgo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3577ca96456f2252cf0197f60bed2ae359af4ce8dde7f8771823834f1e437581
MD5 f0e9070f222ae5e75cb742e98ce0e261
BLAKE2b-256 156fafe2eefcf93a4f86ce1339dbb9ff2816f69ab4b5154c7b235f49b69983b0

See more details on using hashes here.

File details

Details for the file PyJacksonAlgo-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for PyJacksonAlgo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad63a6754f62edfeee442163567de8c708a5caed4d753e88c4850003adffacbd
MD5 0908069388f99f3bdec5cbbdc7316842
BLAKE2b-256 acbc6297af52bef3990af352a430b89db84f46daca73458007a38c217432b9c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page