Skip to main content

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}}
}

Metadata

Release files for PyJacksonAlgo 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyJacksonAlgo 0.1.2
File Size Uploaded
pyjacksonalgo-0.1.2.tar.gz 23.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyJacksonAlgo 0.1.2
File Interpreter ABI Platform
PyJacksonAlgo-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 49.0 kB

Release files / pyjacksonalgo-0.1.2.tar.gz

Download URL pyjacksonalgo-0.1.2.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1c05de682e30c8e018d6b922b6d63771dc95692df4855503f4e638c2f73df136
BLAKE2b-256 checksum
How to use checksums
f0331d4811f9e62398b6f2cd1ae0eebc1260b6e3163c8c8d34eda5d4dfdbceb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / PyJacksonAlgo-0.1.2-py3-none-any.whl

Download URL PyJacksonAlgo-0.1.2-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bbf00d6d3f84ee540d9dd7e260594007333c5096781d68f4e33089d7a7a567d
BLAKE2b-256 checksum
How to use checksums
496719d3fd3b5a0bd8d0a4c74a8d2ba9b6e7957cc49d9ad87d7c46d58d6fd6d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page