job-shop-lib 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- job_shop_lib/__init__.py +20 -0
- job_shop_lib/base_solver.py +37 -0
- job_shop_lib/benchmarking/__init__.py +78 -0
- job_shop_lib/benchmarking/benchmark_instances.json +1 -0
- job_shop_lib/benchmarking/load_benchmark.py +142 -0
- job_shop_lib/cp_sat/__init__.py +5 -0
- job_shop_lib/cp_sat/ortools_solver.py +201 -0
- job_shop_lib/dispatching/__init__.py +49 -0
- job_shop_lib/dispatching/dispatcher.py +269 -0
- job_shop_lib/dispatching/dispatching_rule_solver.py +111 -0
- job_shop_lib/dispatching/dispatching_rules.py +160 -0
- job_shop_lib/dispatching/factories.py +206 -0
- job_shop_lib/dispatching/pruning_functions.py +116 -0
- job_shop_lib/exceptions.py +26 -0
- job_shop_lib/generators/__init__.py +7 -0
- job_shop_lib/generators/basic_generator.py +197 -0
- job_shop_lib/graphs/__init__.py +52 -0
- job_shop_lib/graphs/build_agent_task_graph.py +209 -0
- job_shop_lib/graphs/build_disjunctive_graph.py +78 -0
- job_shop_lib/graphs/constants.py +21 -0
- job_shop_lib/graphs/job_shop_graph.py +159 -0
- job_shop_lib/graphs/node.py +147 -0
- job_shop_lib/job_shop_instance.py +355 -0
- job_shop_lib/operation.py +120 -0
- job_shop_lib/schedule.py +180 -0
- job_shop_lib/scheduled_operation.py +97 -0
- job_shop_lib/visualization/__init__.py +25 -0
- job_shop_lib/visualization/agent_task_graph.py +257 -0
- job_shop_lib/visualization/create_gif.py +191 -0
- job_shop_lib/visualization/disjunctive_graph.py +206 -0
- job_shop_lib/visualization/gantt_chart.py +147 -0
- job_shop_lib-0.1.0.dist-info/LICENSE +21 -0
- job_shop_lib-0.1.0.dist-info/METADATA +363 -0
- job_shop_lib-0.1.0.dist-info/RECORD +35 -0
- job_shop_lib-0.1.0.dist-info/WHEEL +4 -0
job_shop_lib/__init__.py
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
"""Contains the main data structures and base classes.
|
2
|
+
"""
|
3
|
+
|
4
|
+
from job_shop_lib.operation import Operation
|
5
|
+
from job_shop_lib.job_shop_instance import JobShopInstance
|
6
|
+
from job_shop_lib.scheduled_operation import ScheduledOperation
|
7
|
+
from job_shop_lib.schedule import Schedule
|
8
|
+
from job_shop_lib.base_solver import BaseSolver, Solver
|
9
|
+
from job_shop_lib.exceptions import JobShopLibError, NoSolutionFoundError
|
10
|
+
|
11
|
+
__all__ = [
|
12
|
+
"Operation",
|
13
|
+
"JobShopInstance",
|
14
|
+
"ScheduledOperation",
|
15
|
+
"Schedule",
|
16
|
+
"Solver",
|
17
|
+
"BaseSolver",
|
18
|
+
"JobShopLibError",
|
19
|
+
"NoSolutionFoundError",
|
20
|
+
]
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"""Type hint and base class for all solvers."""
|
2
|
+
|
3
|
+
import abc
|
4
|
+
from typing import Callable
|
5
|
+
import time
|
6
|
+
|
7
|
+
from job_shop_lib import JobShopInstance, Schedule
|
8
|
+
|
9
|
+
|
10
|
+
# Every solver should be a callable that takes a JobShopInstance and returns a
|
11
|
+
# Schedule.
|
12
|
+
Solver = Callable[[JobShopInstance], Schedule]
|
13
|
+
|
14
|
+
|
15
|
+
class BaseSolver(abc.ABC):
|
16
|
+
"""Base class for all solvers implemented as classes.
|
17
|
+
|
18
|
+
A `Solver` is any `Callable` that takes a `JobShopInstance` and returns a
|
19
|
+
`Schedule`. Therefore, solvers can be implemented as functions or as
|
20
|
+
classes. This class is provided as a base class for solvers implemented as
|
21
|
+
classes. It provides a default implementation of the `__call__` method that
|
22
|
+
measures the time taken to solve the instance and stores it in the
|
23
|
+
schedule's metadata under the key "elapsed_time" if it is not already
|
24
|
+
present.
|
25
|
+
"""
|
26
|
+
|
27
|
+
@abc.abstractmethod
|
28
|
+
def solve(self, instance: JobShopInstance) -> Schedule:
|
29
|
+
"""Solves the given job shop instance and returns the schedule."""
|
30
|
+
|
31
|
+
def __call__(self, instance: JobShopInstance) -> Schedule:
|
32
|
+
time_start = time.perf_counter()
|
33
|
+
schedule = self.solve(instance)
|
34
|
+
elapsed_time = time_start - time.perf_counter()
|
35
|
+
schedule.metadata["elapsed_time"] = elapsed_time
|
36
|
+
schedule.metadata["solved_by"] = f"{self.__class__.__name__}"
|
37
|
+
return schedule
|
@@ -0,0 +1,78 @@
|
|
1
|
+
"""Package for loading benchmark instances.
|
2
|
+
|
3
|
+
All benchmark instances are stored in a single JSON file. This module provides
|
4
|
+
functions to load the instances from the file and return them as
|
5
|
+
JobShopInstance objects.
|
6
|
+
|
7
|
+
The contributions to this benchmark dataset are as follows:
|
8
|
+
|
9
|
+
abz5-9: This subset, comprising five instances, was introduced by Adams et
|
10
|
+
al. (1988).
|
11
|
+
ft06, ft10, ft20: These three instances are attributed to the work of
|
12
|
+
Fisher and Thompson, as detailed in their 1963 work.
|
13
|
+
la01-40: A collection of forty instances, this group was contributed by
|
14
|
+
Lawrence, as referenced in his 1984 report.
|
15
|
+
orb01-10: Ten instances in this category were provided by Applegate and
|
16
|
+
Cook, as seen in their 1991 study.
|
17
|
+
swb01-20: This segment, encompassing twenty instances, was contributed by
|
18
|
+
Storer et al., as per their 1992 article.
|
19
|
+
yn1-4: Yamada and Nakano are credited with the addition of four instances
|
20
|
+
in this group, as found in their 1992 paper.
|
21
|
+
ta01-80: The largest contribution, consisting of eighty instances, was
|
22
|
+
made by Taillard, as documented in his 1993 paper.
|
23
|
+
|
24
|
+
The metadata from these instances has been updated using data from:
|
25
|
+
|
26
|
+
Thomas Weise. jsspInstancesAndResults. Accessed in January 2024.
|
27
|
+
Available at: https://github.com/thomasWeise/jsspInstancesAndResults
|
28
|
+
|
29
|
+
It includes the following information:
|
30
|
+
- "optimum" (int | None): The optimal makespan for the instance.
|
31
|
+
- "lower_bound" (int): The lower bound for the makespan. If
|
32
|
+
optimality is known, it is equal to the optimum.
|
33
|
+
- "upper_bound" (int): The upper bound for the makespan. If
|
34
|
+
optimality is known, it is equal to the optimum.
|
35
|
+
- "reference" (str): The paper or source where the instance was first
|
36
|
+
introduced.
|
37
|
+
|
38
|
+
References:
|
39
|
+
- J. Adams, E. Balas, and D. Zawack, "The shifting bottleneck procedure
|
40
|
+
for job shop scheduling," Management Science, vol. 34, no. 3,
|
41
|
+
pp. 391–401, 1988.
|
42
|
+
|
43
|
+
- J.F. Muth and G.L. Thompson, Industrial scheduling. Englewood Cliffs,
|
44
|
+
NJ: Prentice-Hall, 1963.
|
45
|
+
|
46
|
+
- S. Lawrence, "Resource constrained project scheduling: An experimental
|
47
|
+
investigation of heuristic scheduling techniques (Supplement),"
|
48
|
+
Carnegie-Mellon University, Graduate School of Industrial
|
49
|
+
Administration, Pittsburgh, Pennsylvania, 1984.
|
50
|
+
|
51
|
+
- D. Applegate and W. Cook, "A computational study of job-shop
|
52
|
+
scheduling," ORSA Journal on Computer, vol. 3, no. 2, pp. 149–156,
|
53
|
+
1991.
|
54
|
+
|
55
|
+
- R.H. Storer, S.D. Wu, and R. Vaccari, "New search spaces for
|
56
|
+
sequencing problems with applications to job-shop scheduling,"
|
57
|
+
Management Science, vol. 38, no. 10, pp. 1495–1509, 1992.
|
58
|
+
|
59
|
+
- T. Yamada and R. Nakano, "A genetic algorithm applicable to
|
60
|
+
large-scale job-shop problems," in Proceedings of the Second
|
61
|
+
International Workshop on Parallel Problem Solving from Nature
|
62
|
+
(PPSN'2), Brussels, Belgium, pp. 281–290, 1992.
|
63
|
+
|
64
|
+
- E. Taillard, "Benchmarks for basic scheduling problems," European
|
65
|
+
Journal of Operational Research, vol. 64, no. 2, pp. 278–285, 1993.
|
66
|
+
"""
|
67
|
+
|
68
|
+
from job_shop_lib.benchmarking.load_benchmark import (
|
69
|
+
load_all_benchmark_instances,
|
70
|
+
load_benchmark_instance,
|
71
|
+
load_benchmark_json,
|
72
|
+
)
|
73
|
+
|
74
|
+
__all__ = [
|
75
|
+
"load_all_benchmark_instances",
|
76
|
+
"load_benchmark_instance",
|
77
|
+
"load_benchmark_json",
|
78
|
+
]
|