Skip to main content

A visualization tool for job shop scheduling problems.

Project description


Job Shop Scheduling Problem Visualisations

About The Project

Ths project provides visualisation for the Job Shop Scheduling Problem (JSP). This is focused on Gantt charts. The input date for the visualisation is inspired by plotly's Gantt chart api. jsp-vis is a standalone package and in designed to be used in combination with a JSP-reinforcement learning environments that follow the Gymnasium Environment standard. The render function of the environment can be used to render the Gantt chart. Typically the render function can implement different modes like human, rgb_array or ansi rendering. The jsp-vis package offers three different visualisations: console visualisation, rgb_array visualisation and window visualisation. The window visualisation is essentially only rendering the rgb_array visualisation in a window using OpenCV. The console visualisation might be used for the asni mode of a render function, the rgb_array visualisation for the rgb_array mode and the window visualisation for the human mode.

Installation

Install the package with pip:

   pip install jsp-vis

Minimal Working Example: console visualisation

from jsp_vis.console import gantt_chart_console
import pandas as pd

df = pd.DataFrame([
   {'Task': 'Job 0', 'Start': 5, 'Finish': 16, 'Resource': 'Machine 0'},
   {'Task': 'Job 0', 'Start': 28, 'Finish': 31, 'Resource': 'Machine 1'},
   {'Task': 'Job 0', 'Start': 31, 'Finish': 34, 'Resource': 'Machine 2'},
   {'Task': 'Job 0', 'Start': 34, 'Finish': 46, 'Resource': 'Machine 3'},
   {'Task': 'Job 1', 'Start': 0, 'Finish': 5, 'Resource': 'Machine 0'},
   {'Task': 'Job 1', 'Start': 5, 'Finish': 21, 'Resource': 'Machine 2'},
   {'Task': 'Job 1', 'Start': 21, 'Finish': 28, 'Resource': 'Machine 1'},
   {'Task': 'Job 1', 'Start': 28, 'Finish': 32, 'Resource': 'Machine 3'}
])
num_of_machines = 4

gantt_chart_console(df, num_of_machines)

The code above will render the following Gantt chart in the console:

Minimal Working Example: console visualisation

from jsp_vis.cv2_window import render_gantt_in_window
import pandas as pd

df = pd.DataFrame([
   {'Task': 'Job 0', 'Start': 5, 'Finish': 16, 'Resource': 'Machine 0'},
   {'Task': 'Job 0', 'Start': 28, 'Finish': 31, 'Resource': 'Machine 1'},
   {'Task': 'Job 0', 'Start': 31, 'Finish': 34, 'Resource': 'Machine 2'},
   {'Task': 'Job 0', 'Start': 34, 'Finish': 46, 'Resource': 'Machine 3'},
   {'Task': 'Job 1', 'Start': 0, 'Finish': 5, 'Resource': 'Machine 0'},
   {'Task': 'Job 1', 'Start': 5, 'Finish': 21, 'Resource': 'Machine 2'},
   {'Task': 'Job 1', 'Start': 21, 'Finish': 28, 'Resource': 'Machine 1'},
   {'Task': 'Job 1', 'Start': 28, 'Finish': 32, 'Resource': 'Machine 3'}
])
num_of_machines = 4

render_gantt_in_window(
        df=df,
        n_machines=num_of_machines,
        wait=2000 # time in ms that the `cv2`-window is open.
        # wait=None # ''None'' will keep the window open till a keyboard occurs.
    )

The code above will render the following Gantt chart in the console:

More Examples

For more examples you can have a look at the test files in the tests directory. Every visualisation has its own test file and is tested on two different jsp instances defined in the conftest.py.

License

Distributed under the MIT License. See LICENSE.txt for more information.

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

jsp_vis-1.0.6.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsp_vis-1.0.6-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file jsp_vis-1.0.6.tar.gz.

File metadata

  • Download URL: jsp_vis-1.0.6.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for jsp_vis-1.0.6.tar.gz
Algorithm Hash digest
SHA256 783925546b7aa6052e77fc85bf986770a0224a5c48cfef5d1d440ca136279b19
MD5 c79fbb862151488bbe78836b7ff0e8d2
BLAKE2b-256 c5920feac00bd74044ecf55a6c20e8352c57b50ada8ac8577978744a63f5025f

See more details on using hashes here.

File details

Details for the file jsp_vis-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: jsp_vis-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for jsp_vis-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 70c8091d1967b6af82a2646e05f7ba049bada860b528c8893b6e80dcff6a72fb
MD5 feae3ba5404c5b640cf7e66999d032ef
BLAKE2b-256 ddd30342617b49381f62d9d09f0c7f9cf9b8b1118d84b7ddca75c21522321d5b

See more details on using hashes here.

Supported by

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