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 Library

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

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.prepare_data()  # 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.prepare_data()  # 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.prepare_data()  # 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.prepare_data()  # 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.2.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

PyJacksonAlgo-0.1.2-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file pyjacksonalgo-0.1.2.tar.gz.

File metadata

  • Download URL: pyjacksonalgo-0.1.2.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pyjacksonalgo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1c05de682e30c8e018d6b922b6d63771dc95692df4855503f4e638c2f73df136
MD5 43011813323129f621c70957ab30f4e1
BLAKE2b-256 f0331d4811f9e62398b6f2cd1ae0eebc1260b6e3163c8c8d34eda5d4dfdbceb8

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for PyJacksonAlgo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3bbf00d6d3f84ee540d9dd7e260594007333c5096781d68f4e33089d7a7a567d
MD5 0e024aa5413ed1aeed4647e283fa9f87
BLAKE2b-256 496719d3fd3b5a0bd8d0a4c74a8d2ba9b6e7957cc49d9ad87d7c46d58d6fd6d8

See more details on using hashes here.

Provenance

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