JSPLib dataset (cpmpy.tools.datasets.jsplib)

JSPLib is a benchmark library of Job Shop Scheduling Problem (JSP) instances. Origin: https://github.com/tamy0612/JSPLIB

class cpmpy.tools.datasets.jsplib.JSPLibDataset(root: str = '.', transform: Callable | None = None, target_transform: Callable | None = None, download: bool = False, **kwargs: Any)[source]

JSP Dataset in a PyTorch compatible format.

  • Origin: https://github.com/tamy0612/JSPLIB

  • References:

      1. Adams, E. Balas, D. Zawack. ‘The shifting bottleneck procedure for job shop scheduling.’, Management Science, Vol. 34, Issue 3, pp. 391-401, 1988.

    • J.F. Muth, G.L. Thompson. ‘Industrial scheduling.’, Englewood Cliffs, NJ, Prentice-Hall, 1963.

      1. Lawrence. ‘Resource constrained project scheduling: an experimental investigation of heuristic scheduling techniques (Supplement).’, Graduate School of Industrial Administration. Pittsburgh, Pennsylvania, Carnegie-Mellon University, 1984.

      1. Applegate, W. Cook. ‘A computational study of job-shop scheduling.’, ORSA Journal on Computer, Vol. 3, Isuue 2, pp. 149-156, 1991.

    • R.H. Storer, S.D. Wu, R. Vaccari. ‘New search spaces for sequencing problems with applications to job-shop scheduling.’, Management Science Vol. 38, Issue 10, pp. 1495-1509, 1992.

      1. Yamada, R. Nakano. ‘A genetic algorithm applicable to large-scale job-shop problems.’, Proceedings of the Second international workshop on parallel problem solving from Nature (PPSN’2). Brussels (Belgium), pp. 281-290, 1992.

      1. Taillard. ‘Benchmarks for basic scheduling problems’, European Journal of Operational Research, Vol. 64, Issue 2, pp. 278-285, 1993.

To load an instance into a CPMpy model, use load_jsplib(). For examples of using a loader as a dataset transform, see the modeling guide.

Parameters:
  • root (str) – Root directory containing the jsp instances (if ‘download’, instances will be downloaded to this location)

  • transform (callable, optional) – Optional transform to be applied on the instance data (the file path of each problem instance)

  • target_transform (callable, optional) – Optional transform to be applied on the metadata (the metadata dictionary of each problem instance)

  • download (bool) – If True, downloads the dataset from the internet and puts it in root directory

METADATA_EXTENSION: ClassVar[str] = '.meta.json'
categories() dict[str, Any][source]

Labels to distinguish instances into categories matching to those of the dataset, e.g. year or track.

citation: ClassVar[List[str]] = ["J. Adams, E. Balas, D. Zawack. 'The shifting bottleneck procedure for job shop scheduling.', Management Science, Vol. 34, Issue 3, pp. 391-401, 1988.", "J.F. Muth, G.L. Thompson. 'Industrial scheduling.', Englewood Cliffs, NJ, Prentice-Hall, 1963.", "S. Lawrence. 'Resource constrained project scheduling: an experimental investigation of heuristic scheduling techniques (Supplement).', Graduate School of Industrial Administration. Pittsburgh, Pennsylvania, Carnegie-Mellon University, 1984.", "D. Applegate, W. Cook. 'A computational study of job-shop scheduling.', ORSA Journal on Computer, Vol. 3, Isuue 2, pp. 149-156, 1991.", "R.H. Storer, S.D. Wu, R. Vaccari. 'New search spaces for sequencing problems with applications to job-shop scheduling.', Management Science Vol. 38, Issue 10, pp. 1495-1509, 1992.", "T. Yamada, R. Nakano. 'A genetic algorithm applicable to large-scale job-shop problems.', Proceedings of the Second international workshop on parallel problem solving from Nature (PPSN'2). Brussels (Belgium), pp. 281-290, 1992.", "E. Taillard. 'Benchmarks for basic scheduling problems', European Journal of Operational Research, Vol. 64, Issue 2, pp. 278-285, 1993."]
collect_instance_metadata(file: Path) dict[str, Any][source]

Extract metadata from instances.json and instance file header.

classmethod dataset_metadata() dict[str, Any]

Return dataset-level metadata as a dictionary.

Returns:

The dataset-level metadata.

Return type:

dict

description: ClassVar[str] = 'Job Shop Scheduling Problem benchmark library.'
download()[source]

Download the dataset.

homepage: ClassVar[str] = 'https://github.com/tamy0612/JSPLIB'
instance_metadata(instance: PathLike) dict[str, Any]

Return the metadata for a given instance file.

Parameters:

file (os.PathLike) – Path to the instance file.

Returns:

The metadata for the instance.

Return type:

dict

name: ClassVar[str] = 'jsplib'
classmethod open(instance: PathLike) TextIOBase[source]

How an instance file from the dataset should be opened. Especially usefull when files come compressed and won’t work with Python standard library’s ‘open’, e.g. ‘.xz’, ‘.lzma’.

Parameters:

instance (os.PathLike) – File path to the instance file.

Returns:

The opened file handle.

Return type:

io.TextIOBase

classmethod parse(instance: PathLike) tuple[ndarray, ndarray][source]

Parse a JSPLib instance into task routing and durations.

read(instance: PathLike) str

Read raw file contents from an instance file. Handles optional decompression automatically via dataset.open().

Parameters:

instance (os.PathLike) – File path to the instance file.

Returns:

The raw file contents.

Return type:

str