job-shop-lib 1.0.0a2__py3-none-any.whl → 1.0.0a4__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/_job_shop_instance.py +119 -55
- job_shop_lib/_operation.py +18 -7
- job_shop_lib/_schedule.py +13 -15
- job_shop_lib/_scheduled_operation.py +17 -18
- job_shop_lib/dispatching/__init__.py +4 -0
- job_shop_lib/dispatching/_dispatcher.py +36 -47
- job_shop_lib/dispatching/_dispatcher_observer_config.py +15 -2
- job_shop_lib/dispatching/_factories.py +10 -2
- job_shop_lib/dispatching/_ready_operation_filters.py +80 -0
- job_shop_lib/dispatching/feature_observers/_composite_feature_observer.py +0 -1
- job_shop_lib/dispatching/feature_observers/_factory.py +21 -18
- job_shop_lib/dispatching/feature_observers/_is_completed_observer.py +1 -0
- job_shop_lib/dispatching/feature_observers/_is_ready_observer.py +1 -1
- job_shop_lib/dispatching/rules/_dispatching_rule_solver.py +44 -25
- job_shop_lib/dispatching/rules/_dispatching_rules_functions.py +9 -9
- job_shop_lib/generation/_general_instance_generator.py +33 -34
- job_shop_lib/generation/_instance_generator.py +14 -17
- job_shop_lib/generation/_transformations.py +11 -8
- job_shop_lib/graphs/__init__.py +3 -0
- job_shop_lib/graphs/_build_disjunctive_graph.py +41 -3
- job_shop_lib/graphs/graph_updaters/_graph_updater.py +11 -13
- job_shop_lib/graphs/graph_updaters/_residual_graph_updater.py +17 -20
- job_shop_lib/reinforcement_learning/__init__.py +16 -7
- job_shop_lib/reinforcement_learning/_multi_job_shop_graph_env.py +69 -57
- job_shop_lib/reinforcement_learning/_single_job_shop_graph_env.py +43 -32
- job_shop_lib/reinforcement_learning/_types_and_constants.py +2 -2
- job_shop_lib/visualization/__init__.py +29 -10
- job_shop_lib/visualization/_gantt_chart_creator.py +122 -84
- job_shop_lib/visualization/_gantt_chart_video_and_gif_creation.py +68 -37
- job_shop_lib/visualization/_plot_disjunctive_graph.py +382 -0
- job_shop_lib/visualization/{_gantt_chart.py → _plot_gantt_chart.py} +78 -14
- {job_shop_lib-1.0.0a2.dist-info → job_shop_lib-1.0.0a4.dist-info}/METADATA +15 -3
- {job_shop_lib-1.0.0a2.dist-info → job_shop_lib-1.0.0a4.dist-info}/RECORD +36 -36
- {job_shop_lib-1.0.0a2.dist-info → job_shop_lib-1.0.0a4.dist-info}/WHEEL +1 -1
- job_shop_lib/visualization/_disjunctive_graph.py +0 -210
- /job_shop_lib/visualization/{_agent_task_graph.py → _plot_agent_task_graph.py} +0 -0
- {job_shop_lib-1.0.0a2.dist-info → job_shop_lib-1.0.0a4.dist-info}/LICENSE +0 -0
@@ -23,6 +23,17 @@ class GraphUpdater(DispatcherObserver):
|
|
23
23
|
job_shop_graph:
|
24
24
|
The current job shop graph. This is the graph that is updated
|
25
25
|
after each scheduled operation.
|
26
|
+
|
27
|
+
Args:
|
28
|
+
dispatcher:
|
29
|
+
The dispatcher instance to observe.
|
30
|
+
job_shop_graph:
|
31
|
+
The job shop graph to update.
|
32
|
+
subscribe:
|
33
|
+
Whether to subscribe to the dispatcher. If ``True``, the
|
34
|
+
observer will subscribe to the dispatcher when it is
|
35
|
+
initialized. If ``False``, the observer will not subscribe
|
36
|
+
to the dispatcher.
|
26
37
|
"""
|
27
38
|
|
28
39
|
def __init__(
|
@@ -32,19 +43,6 @@ class GraphUpdater(DispatcherObserver):
|
|
32
43
|
*,
|
33
44
|
subscribe: bool = True,
|
34
45
|
):
|
35
|
-
"""Initializes the class.
|
36
|
-
|
37
|
-
Args:
|
38
|
-
dispatcher:
|
39
|
-
The dispatcher instance to observe.
|
40
|
-
job_shop_graph:
|
41
|
-
The job shop graph to update.
|
42
|
-
subscribe:
|
43
|
-
Whether to subscribe to the dispatcher. If ``True``, the
|
44
|
-
observer will subscribe to the dispatcher when it is
|
45
|
-
initialized. If ``False``, the observer will not subscribe
|
46
|
-
to the dispatcher.
|
47
|
-
"""
|
48
46
|
super().__init__(dispatcher, subscribe=subscribe)
|
49
47
|
self.initial_job_shop_graph = deepcopy(job_shop_graph)
|
50
48
|
self.job_shop_graph = job_shop_graph
|
@@ -25,9 +25,24 @@ class ResidualGraphUpdater(GraphUpdater):
|
|
25
25
|
|
26
26
|
Attributes:
|
27
27
|
remove_completed_machine_nodes:
|
28
|
-
If True
|
28
|
+
If ``True``, removes completed machine nodes from the graph.
|
29
29
|
remove_completed_job_nodes:
|
30
|
-
If True
|
30
|
+
If ``True``, removes completed job nodes from the graph.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
dispatcher:
|
34
|
+
The dispatcher instance to observe.
|
35
|
+
job_shop_graph:
|
36
|
+
The job shop graph to update.
|
37
|
+
subscribe:
|
38
|
+
If ``True``, automatically subscribes the observer to the
|
39
|
+
dispatcher. Defaults to ``True``.
|
40
|
+
remove_completed_machine_nodes:
|
41
|
+
If ``True``, removes completed machine nodes from the graph.
|
42
|
+
Defaults to ``True``.
|
43
|
+
remove_completed_job_nodes:
|
44
|
+
If ``True``, removes completed job nodes from the graph.
|
45
|
+
Defaults to ``True``.
|
31
46
|
"""
|
32
47
|
|
33
48
|
def __init__(
|
@@ -39,24 +54,6 @@ class ResidualGraphUpdater(GraphUpdater):
|
|
39
54
|
remove_completed_machine_nodes: bool = True,
|
40
55
|
remove_completed_job_nodes: bool = True,
|
41
56
|
):
|
42
|
-
"""Initializes the residual graph updater.
|
43
|
-
|
44
|
-
Args:
|
45
|
-
dispatcher:
|
46
|
-
The dispatcher instance to observe.
|
47
|
-
job_shop_graph:
|
48
|
-
The job shop graph to update.
|
49
|
-
subscribe:
|
50
|
-
If True, automatically subscribes the observer to the
|
51
|
-
dispatcher. Defaults to True.
|
52
|
-
remove_completed_machine_nodes:
|
53
|
-
If True, removes completed machine nodes from the graph.
|
54
|
-
Defaults to True.
|
55
|
-
remove_completed_job_nodes:
|
56
|
-
If True, removes completed job nodes from the graph.
|
57
|
-
Defaults to True.
|
58
|
-
"""
|
59
|
-
|
60
57
|
self._is_completed_observer: None | IsCompletedObserver = None
|
61
58
|
self.remove_completed_job_nodes = remove_completed_job_nodes
|
62
59
|
self.remove_completed_machine_nodes = remove_completed_machine_nodes
|
@@ -1,12 +1,24 @@
|
|
1
|
-
"""
|
1
|
+
"""Contains reinforcement learning components.
|
2
|
+
|
3
|
+
|
4
|
+
.. autosummary::
|
5
|
+
|
6
|
+
SingleJobShopGraphEnv
|
7
|
+
MultiJobShopGraphEnv
|
8
|
+
ObservationDict
|
9
|
+
ObservationSpaceKey
|
10
|
+
RewardObserver
|
11
|
+
MakespanReward
|
12
|
+
IdleTimeReward
|
13
|
+
RenderConfig
|
14
|
+
add_padding
|
15
|
+
|
16
|
+
"""
|
2
17
|
|
3
18
|
from job_shop_lib.reinforcement_learning._types_and_constants import (
|
4
19
|
ObservationSpaceKey,
|
5
20
|
RenderConfig,
|
6
21
|
ObservationDict,
|
7
|
-
GanttChartWrapperConfig,
|
8
|
-
GifConfig,
|
9
|
-
VideoConfig,
|
10
22
|
)
|
11
23
|
|
12
24
|
from job_shop_lib.reinforcement_learning._reward_observers import (
|
@@ -30,9 +42,6 @@ __all__ = [
|
|
30
42
|
"RewardObserver",
|
31
43
|
"MakespanReward",
|
32
44
|
"IdleTimeReward",
|
33
|
-
"GanttChartWrapperConfig",
|
34
|
-
"GifConfig",
|
35
|
-
"VideoConfig",
|
36
45
|
"SingleJobShopGraphEnv",
|
37
46
|
"RenderConfig",
|
38
47
|
"ObservationDict",
|
@@ -42,11 +42,11 @@ class MultiJobShopGraphEnv(gym.Env):
|
|
42
42
|
|
43
43
|
The observation space includes:
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
- removed_nodes: Binary vector indicating removed nodes.
|
46
|
+
- edge_index: Edge list in COO format.
|
47
|
+
- operations: Matrix of operation features.
|
48
|
+
- jobs: Matrix of job features (if applicable).
|
49
|
+
- machines: Matrix of machine features (if applicable).
|
50
50
|
|
51
51
|
Internally, the class creates a
|
52
52
|
:class:`~job_shop_lib.reinforcement_learning.SingleJobShopGraphEnv`
|
@@ -57,29 +57,37 @@ class MultiJobShopGraphEnv(gym.Env):
|
|
57
57
|
instance_generator:
|
58
58
|
A :class:`~job_shop_lib.generation.InstanceGenerator` that
|
59
59
|
generates a new problem instance on each reset.
|
60
|
+
|
60
61
|
action_space:
|
61
62
|
:class:`gymnasium.spaces.Discrete`) action space with size equal to
|
62
63
|
the maximum number of jobs.
|
64
|
+
|
63
65
|
observation_space:
|
64
66
|
Dictionary of observation spaces. Keys are defined in
|
65
67
|
:class:`~job_shop_lib.reinforcement_learning.ObservationSpaceKey`.
|
68
|
+
|
66
69
|
single_job_shop_graph_env:
|
67
70
|
Environment for a specific Job Shop Scheduling Problem instance.
|
68
71
|
See :class:`SingleJobShopGraphEnv`.
|
72
|
+
|
69
73
|
graph_initializer:
|
70
74
|
Function to create the initial graph representation. It should
|
71
75
|
take a :class:`~job_shop_lib.JobShopInstance` as input and return
|
72
76
|
a :class:`~job_shop_lib.graphs.JobShopGraph`.
|
77
|
+
|
73
78
|
render_mode:
|
74
79
|
Rendering mode for visualization. Supported modes are:
|
80
|
+
|
75
81
|
- human: Renders the current Gannt chart.
|
76
82
|
- save_video: Saves a video of the Gantt chart. Used only if the
|
77
83
|
schedule is completed.
|
78
84
|
- save_gif: Saves a GIF of the Gantt chart. Used only if the
|
79
85
|
schedule is completed.
|
86
|
+
|
80
87
|
render_config:
|
81
88
|
Configuration for rendering. See
|
82
89
|
:class:`~job_shop_lib.RenderConfig`.
|
90
|
+
|
83
91
|
feature_observer_configs:
|
84
92
|
List of :class:`~job_shop_lib.dispatching.DispatcherObserverConfig`
|
85
93
|
for feature observers.
|
@@ -87,11 +95,63 @@ class MultiJobShopGraphEnv(gym.Env):
|
|
87
95
|
Configuration for the reward function. See
|
88
96
|
:class:`~job_shop_lib.dispatching.DispatcherObserverConfig` and
|
89
97
|
:class:`~job_shop_lib.dispatching.RewardObserver`.
|
98
|
+
|
90
99
|
graph_updater_config:
|
91
100
|
Configuration for the graph updater. The graph updater is used to
|
92
101
|
update the graph representation after each action. See
|
93
102
|
:class:`~job_shop_lib.dispatching.DispatcherObserverConfig` and
|
94
103
|
:class:`~job_shop_lib.graphs.GraphUpdater`.
|
104
|
+
Args:
|
105
|
+
instance_generator:
|
106
|
+
A :class:`~job_shop_lib.generation.InstanceGenerator` that
|
107
|
+
generates a new problem instance on each reset.
|
108
|
+
|
109
|
+
feature_observer_configs:
|
110
|
+
Configurations for feature observers. Each configuration
|
111
|
+
should be a
|
112
|
+
:class:`~job_shop_lib.dispatching.DispatcherObserverConfig`
|
113
|
+
with a class type that inherits from
|
114
|
+
:class:`~job_shop_lib.dispatching.FeatureObserver` or a string
|
115
|
+
or enum that represents a built-in feature observer.
|
116
|
+
|
117
|
+
graph_initializer:
|
118
|
+
Function to create the initial graph representation.
|
119
|
+
If ``None``, the default graph initializer is used:
|
120
|
+
:func:`~job_shop_lib.graphs.build_agent_task_graph`.
|
121
|
+
graph_updater_config:
|
122
|
+
Configuration for the graph updater. The graph updater is used
|
123
|
+
to update the graph representation after each action. If
|
124
|
+
``None``, the default graph updater is used:
|
125
|
+
:class:`~job_shop_lib.graphs.ResidualGraphUpdater`.
|
126
|
+
|
127
|
+
ready_operations_filter:
|
128
|
+
Function to filter ready operations. If ``None``, the default
|
129
|
+
filter is used:
|
130
|
+
:func:`~job_shop_lib.dispatching.filter_dominated_operations`.
|
131
|
+
|
132
|
+
reward_function_config:
|
133
|
+
Configuration for the reward function. If ``None``, the default
|
134
|
+
reward function is used:
|
135
|
+
:class:`~job_shop_lib.dispatching.MakespanReward`.
|
136
|
+
|
137
|
+
render_mode:
|
138
|
+
Rendering mode for visualization. Supported modes are:
|
139
|
+
|
140
|
+
- human: Renders the current Gannt chart.
|
141
|
+
- save_video: Saves a video of the Gantt chart. Used only if
|
142
|
+
the schedule is completed.
|
143
|
+
- save_gif: Saves a GIF of the Gantt chart. Used only if the
|
144
|
+
schedule is completed.
|
145
|
+
render_config:
|
146
|
+
Configuration for rendering. See
|
147
|
+
:class:`~job_shop_lib.RenderConfig`.
|
148
|
+
|
149
|
+
use_padding:
|
150
|
+
Whether to use padding in observations. If True, all matrices
|
151
|
+
are padded to fixed sizes based on the maximum instance size.
|
152
|
+
Values are padded with -1, except for the "removed_nodes" key,
|
153
|
+
which is padded with ``True``, indicating that the node is
|
154
|
+
removed.
|
95
155
|
"""
|
96
156
|
|
97
157
|
def __init__(
|
@@ -114,53 +174,6 @@ class MultiJobShopGraphEnv(gym.Env):
|
|
114
174
|
render_config: RenderConfig | None = None,
|
115
175
|
use_padding: bool = True,
|
116
176
|
) -> None:
|
117
|
-
"""Initializes the environment.
|
118
|
-
|
119
|
-
Args:
|
120
|
-
instance_generator:
|
121
|
-
A :class:`~job_shop_lib.generation.InstanceGenerator` that
|
122
|
-
generates a new problem instance on each reset.
|
123
|
-
feature_observer_configs:
|
124
|
-
Configurations for feature observers. Each configuration
|
125
|
-
should be a
|
126
|
-
:class:`~job_shop_lib.dispatching.DispatcherObserverConfig`
|
127
|
-
with a class type that inherits from
|
128
|
-
:class:`~job_shop_lib.dispatching.FeatureObserver` or a string
|
129
|
-
or enum that represents a built-in feature observer.
|
130
|
-
graph_initializer:
|
131
|
-
Function to create the initial graph representation.
|
132
|
-
If ``None``, the default graph initializer is used:
|
133
|
-
:func:`~job_shop_lib.graphs.build_agent_task_graph`.
|
134
|
-
graph_updater_config:
|
135
|
-
Configuration for the graph updater. The graph updater is used
|
136
|
-
to update the graph representation after each action. If
|
137
|
-
``None``, the default graph updater is used:
|
138
|
-
:class:`~job_shop_lib.graphs.ResidualGraphUpdater`.
|
139
|
-
ready_operations_filter:
|
140
|
-
Function to filter ready operations. If ``None``, the default
|
141
|
-
filter is used:
|
142
|
-
:func:`~job_shop_lib.dispatching.filter_dominated_operations`.
|
143
|
-
reward_function_config:
|
144
|
-
Configuration for the reward function. If ``None``, the default
|
145
|
-
reward function is used:
|
146
|
-
:class:`~job_shop_lib.dispatching.MakespanReward`.
|
147
|
-
render_mode:
|
148
|
-
Rendering mode for visualization. Supported modes are:
|
149
|
-
- human: Renders the current Gannt chart.
|
150
|
-
- save_video: Saves a video of the Gantt chart. Used only if
|
151
|
-
the schedule is completed.
|
152
|
-
- save_gif: Saves a GIF of the Gantt chart. Used only if the
|
153
|
-
schedule is completed.
|
154
|
-
render_config:
|
155
|
-
Configuration for rendering. See
|
156
|
-
:class:`~job_shop_lib.RenderConfig`.
|
157
|
-
use_padding:
|
158
|
-
Whether to use padding in observations. If True, all matrices
|
159
|
-
are padded to fixed sizes based on the maximum instance size.
|
160
|
-
Values are padded with -1, except for the "removed_nodes" key,
|
161
|
-
which is padded with ``True``, indicating that the node is
|
162
|
-
removed.
|
163
|
-
"""
|
164
177
|
super().__init__()
|
165
178
|
|
166
179
|
# Create an instance with the maximum size
|
@@ -303,16 +316,15 @@ class MultiJobShopGraphEnv(gym.Env):
|
|
303
316
|
|
304
317
|
Returns:
|
305
318
|
A tuple containing the following elements:
|
319
|
+
|
306
320
|
- The observation of the environment.
|
307
321
|
- The reward obtained.
|
308
322
|
- Whether the environment is done.
|
309
323
|
- Whether the episode was truncated (always False).
|
310
324
|
- A dictionary with additional information. The dictionary
|
311
|
-
contains the following keys:
|
312
|
-
|
313
|
-
|
314
|
-
- "available_operations": The operations that are ready to be
|
315
|
-
scheduled.
|
325
|
+
contains the following keys: ``"feature_names"``, The names of
|
326
|
+
the features in the observation; ``"available_operations"``, the
|
327
|
+
operations that are ready to be scheduled.
|
316
328
|
"""
|
317
329
|
obs, reward, done, truncated, info = (
|
318
330
|
self.single_job_shop_graph_env.step(action)
|
@@ -45,6 +45,7 @@ class SingleJobShopGraphEnv(gym.Env):
|
|
45
45
|
|
46
46
|
Observation Space:
|
47
47
|
A dictionary with the following keys:
|
48
|
+
|
48
49
|
- "removed_nodes": Binary vector indicating removed graph nodes.
|
49
50
|
- "edge_list": Matrix of graph edges in COO format.
|
50
51
|
- Feature matrices: Keys corresponding to the composite observer
|
@@ -54,43 +55,76 @@ class SingleJobShopGraphEnv(gym.Env):
|
|
54
55
|
MultiDiscrete space representing (job_id, machine_id) pairs.
|
55
56
|
|
56
57
|
Render Modes:
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
|
59
|
+
- "human": Displays the current Gantt chart.
|
60
|
+
- "save_video": Saves a video of the complete Gantt chart.
|
61
|
+
- "save_gif": Saves a GIF of the complete Gantt chart.
|
60
62
|
|
61
63
|
Attributes:
|
62
64
|
dispatcher:
|
63
65
|
Manages the scheduling process. See
|
64
66
|
:class:`~job_shop_lib.dispatching.Dispatcher`.
|
67
|
+
|
65
68
|
composite_observer:
|
66
69
|
A :class:`~job_shop_lib.dispatching.feature_observers.
|
67
70
|
CompositeFeatureObserver` which aggregates features from multiple
|
68
71
|
observers.
|
72
|
+
|
69
73
|
graph_updater:
|
70
74
|
Updates the graph representation after each action. See
|
71
75
|
:class:`~job_shop_lib.graphs.GraphUpdater`.
|
76
|
+
|
72
77
|
reward_function:
|
73
78
|
Computes rewards for actions taken. See
|
74
79
|
:class:`~job_shop_lib.reinforcement_learning.RewardObserver`.
|
80
|
+
|
75
81
|
action_space:
|
76
82
|
Defines the action space. The action is a tuple of two integers
|
77
83
|
(job_id, machine_id). The machine_id can be -1 if the selected
|
78
84
|
operation can only be scheduled in one machine.
|
85
|
+
|
79
86
|
observation_space:
|
80
87
|
Defines the observation space. The observation is a dictionary
|
81
88
|
with the following keys:
|
89
|
+
|
82
90
|
- "removed_nodes": Binary vector indicating removed graph nodes.
|
83
91
|
- "edge_list": Matrix of graph edges in COO format.
|
84
92
|
- Feature matrices: Keys corresponding to the composite observer
|
85
93
|
features (e.g., "operations", "jobs", "machines").
|
94
|
+
|
86
95
|
render_mode:
|
87
96
|
The mode for rendering the environment ("human", "save_video",
|
88
97
|
"save_gif").
|
98
|
+
|
89
99
|
gantt_chart_creator:
|
90
100
|
Creates Gantt chart visualizations. See
|
91
101
|
:class:`~job_shop_lib.visualization.GanttChartCreator`.
|
102
|
+
|
92
103
|
use_padding:
|
93
104
|
Whether to use padding in observations. Padding maintains the
|
105
|
+
observation space shape when the number of nodes changes.
|
106
|
+
|
107
|
+
Args:
|
108
|
+
job_shop_graph:
|
109
|
+
The JobShopGraph instance representing the job shop problem.
|
110
|
+
feature_observer_configs:
|
111
|
+
A list of FeatureObserverConfig instances for the feature
|
112
|
+
observers.
|
113
|
+
reward_function_config:
|
114
|
+
The configuration for the reward function.
|
115
|
+
graph_updater_config:
|
116
|
+
The configuration for the graph updater.
|
117
|
+
ready_operations_filter:
|
118
|
+
The function to use for pruning dominated operations.
|
119
|
+
render_mode:
|
120
|
+
The mode for rendering the environment ("human", "save_video",
|
121
|
+
"save_gif").
|
122
|
+
render_config:
|
123
|
+
Configuration for rendering (e.g., paths for saving videos
|
124
|
+
or GIFs). See :class:`~job_shop_lib.visualization.RenderConfig`.
|
125
|
+
use_padding:
|
126
|
+
Whether to use padding in observations. Padding maintains the
|
127
|
+
observation space shape when the number of nodes changes.
|
94
128
|
"""
|
95
129
|
|
96
130
|
metadata = {"render_modes": ["human", "save_video", "save_gif"]}
|
@@ -116,29 +150,6 @@ class SingleJobShopGraphEnv(gym.Env):
|
|
116
150
|
render_config: RenderConfig | None = None,
|
117
151
|
use_padding: bool = True,
|
118
152
|
) -> None:
|
119
|
-
"""Initializes the SingleJobShopGraphEnv environment.
|
120
|
-
|
121
|
-
Args:
|
122
|
-
job_shop_graph:
|
123
|
-
The JobShopGraph instance representing the job shop problem.
|
124
|
-
feature_observer_configs:
|
125
|
-
A list of FeatureObserverConfig instances for the feature
|
126
|
-
observers.
|
127
|
-
reward_function_config:
|
128
|
-
The configuration for the reward function.
|
129
|
-
graph_updater_config:
|
130
|
-
The configuration for the graph updater.
|
131
|
-
ready_operations_filter:
|
132
|
-
The function to use for pruning dominated operations.
|
133
|
-
render_mode:
|
134
|
-
The mode for rendering the environment ("human", "save_video",
|
135
|
-
"save_gif").
|
136
|
-
render_config:
|
137
|
-
Configuration for rendering (e.g., paths for saving videos
|
138
|
-
or GIFs).
|
139
|
-
use_padding:
|
140
|
-
Whether to use padding for the edge index.
|
141
|
-
"""
|
142
153
|
super().__init__()
|
143
154
|
# Used for resetting the environment
|
144
155
|
self.initial_job_shop_graph = deepcopy(job_shop_graph)
|
@@ -236,16 +247,16 @@ class SingleJobShopGraphEnv(gym.Env):
|
|
236
247
|
|
237
248
|
Returns:
|
238
249
|
A tuple containing the following elements:
|
250
|
+
|
239
251
|
- The observation of the environment.
|
240
252
|
- The reward obtained.
|
241
253
|
- Whether the environment is done.
|
242
254
|
- Whether the episode was truncated (always False).
|
243
255
|
- A dictionary with additional information. The dictionary
|
244
|
-
contains the following keys:
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
scheduled.
|
256
|
+
contains the following keys: "feature_names", the names of the
|
257
|
+
features in the observation; "available_operations", the
|
258
|
+
operations that are ready to be scheduled.
|
259
|
+
|
249
260
|
"""
|
250
261
|
job_id, machine_id = action
|
251
262
|
operation = self.dispatcher.next_operation(job_id)
|
@@ -260,7 +271,7 @@ class SingleJobShopGraphEnv(gym.Env):
|
|
260
271
|
truncated = False
|
261
272
|
info: dict[str, Any] = {
|
262
273
|
"feature_names": self.composite_observer.column_names,
|
263
|
-
"available_operations": self.dispatcher.
|
274
|
+
"available_operations": self.dispatcher.available_operations(),
|
264
275
|
}
|
265
276
|
return obs, reward, done, truncated, info
|
266
277
|
|
@@ -8,7 +8,7 @@ import numpy as np
|
|
8
8
|
|
9
9
|
from job_shop_lib.dispatching.feature_observers import FeatureType
|
10
10
|
from job_shop_lib.visualization import (
|
11
|
-
|
11
|
+
PartialGanttChartPlotterConfig,
|
12
12
|
GifConfig,
|
13
13
|
VideoConfig,
|
14
14
|
)
|
@@ -17,7 +17,7 @@ from job_shop_lib.visualization import (
|
|
17
17
|
class RenderConfig(TypedDict, total=False):
|
18
18
|
"""Configuration needed to initialize the `GanttChartCreator` class."""
|
19
19
|
|
20
|
-
|
20
|
+
partial_gantt_chart_plotter_config: PartialGanttChartPlotterConfig
|
21
21
|
video_config: VideoConfig
|
22
22
|
gif_config: GifConfig
|
23
23
|
|
@@ -1,24 +1,41 @@
|
|
1
|
-
"""
|
1
|
+
"""Contains functions and classes for visualizing job shop scheduling problems.
|
2
2
|
|
3
|
-
|
3
|
+
.. autosummary::
|
4
|
+
|
5
|
+
plot_gantt_chart
|
6
|
+
get_partial_gantt_chart_plotter
|
7
|
+
PartialGanttChartPlotter
|
8
|
+
create_gantt_chart_video
|
9
|
+
create_gantt_chart_gif
|
10
|
+
plot_disjunctive_graph
|
11
|
+
plot_agent_task_graph
|
12
|
+
GanttChartCreator
|
13
|
+
GifConfig
|
14
|
+
VideoConfig
|
15
|
+
|
16
|
+
"""
|
17
|
+
|
18
|
+
from job_shop_lib.visualization._plot_gantt_chart import plot_gantt_chart
|
4
19
|
from job_shop_lib.visualization._gantt_chart_video_and_gif_creation import (
|
5
|
-
|
20
|
+
create_gantt_chart_gif,
|
6
21
|
create_gantt_chart_video,
|
7
22
|
create_gantt_chart_frames,
|
8
|
-
|
23
|
+
get_partial_gantt_chart_plotter,
|
9
24
|
create_video_from_frames,
|
10
25
|
create_gif_from_frames,
|
26
|
+
PartialGanttChartPlotter,
|
11
27
|
)
|
12
|
-
from job_shop_lib.visualization.
|
28
|
+
from job_shop_lib.visualization._plot_disjunctive_graph import (
|
13
29
|
plot_disjunctive_graph,
|
30
|
+
duration_labeler,
|
14
31
|
)
|
15
|
-
from job_shop_lib.visualization.
|
32
|
+
from job_shop_lib.visualization._plot_agent_task_graph import (
|
16
33
|
plot_agent_task_graph,
|
17
34
|
three_columns_layout,
|
18
35
|
)
|
19
36
|
from job_shop_lib.visualization._gantt_chart_creator import (
|
20
37
|
GanttChartCreator,
|
21
|
-
|
38
|
+
PartialGanttChartPlotterConfig,
|
22
39
|
GifConfig,
|
23
40
|
VideoConfig,
|
24
41
|
)
|
@@ -26,16 +43,18 @@ from job_shop_lib.visualization._gantt_chart_creator import (
|
|
26
43
|
__all__ = [
|
27
44
|
"plot_gantt_chart",
|
28
45
|
"create_gantt_chart_video",
|
29
|
-
"
|
46
|
+
"create_gantt_chart_gif",
|
30
47
|
"create_gantt_chart_frames",
|
31
|
-
"
|
48
|
+
"get_partial_gantt_chart_plotter",
|
32
49
|
"create_gif_from_frames",
|
33
50
|
"create_video_from_frames",
|
34
51
|
"plot_disjunctive_graph",
|
35
52
|
"plot_agent_task_graph",
|
36
53
|
"three_columns_layout",
|
37
54
|
"GanttChartCreator",
|
38
|
-
"
|
55
|
+
"PartialGanttChartPlotterConfig",
|
39
56
|
"GifConfig",
|
40
57
|
"VideoConfig",
|
58
|
+
"PartialGanttChartPlotter",
|
59
|
+
"duration_labeler",
|
41
60
|
]
|