job-shop-lib 1.0.0a3__py3-none-any.whl → 1.0.0a4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. job_shop_lib/_job_shop_instance.py +104 -38
  2. job_shop_lib/_operation.py +12 -3
  3. job_shop_lib/_schedule.py +10 -12
  4. job_shop_lib/_scheduled_operation.py +15 -16
  5. job_shop_lib/dispatching/_dispatcher.py +12 -15
  6. job_shop_lib/dispatching/_dispatcher_observer_config.py +15 -2
  7. job_shop_lib/dispatching/_factories.py +2 -2
  8. job_shop_lib/dispatching/feature_observers/_composite_feature_observer.py +0 -1
  9. job_shop_lib/dispatching/feature_observers/_factory.py +21 -18
  10. job_shop_lib/dispatching/feature_observers/_is_completed_observer.py +1 -0
  11. job_shop_lib/dispatching/rules/_dispatching_rule_solver.py +1 -1
  12. job_shop_lib/generation/_general_instance_generator.py +33 -34
  13. job_shop_lib/generation/_instance_generator.py +14 -17
  14. job_shop_lib/generation/_transformations.py +11 -8
  15. job_shop_lib/graphs/__init__.py +3 -0
  16. job_shop_lib/graphs/_build_disjunctive_graph.py +41 -3
  17. job_shop_lib/graphs/graph_updaters/_graph_updater.py +11 -13
  18. job_shop_lib/graphs/graph_updaters/_residual_graph_updater.py +17 -20
  19. job_shop_lib/reinforcement_learning/__init__.py +16 -7
  20. job_shop_lib/reinforcement_learning/_multi_job_shop_graph_env.py +69 -57
  21. job_shop_lib/reinforcement_learning/_single_job_shop_graph_env.py +42 -31
  22. job_shop_lib/reinforcement_learning/_types_and_constants.py +2 -2
  23. job_shop_lib/visualization/__init__.py +24 -5
  24. job_shop_lib/visualization/_gantt_chart_creator.py +118 -80
  25. job_shop_lib/visualization/_gantt_chart_video_and_gif_creation.py +15 -11
  26. job_shop_lib/visualization/_plot_disjunctive_graph.py +382 -0
  27. {job_shop_lib-1.0.0a3.dist-info → job_shop_lib-1.0.0a4.dist-info}/METADATA +5 -5
  28. {job_shop_lib-1.0.0a3.dist-info → job_shop_lib-1.0.0a4.dist-info}/RECORD +31 -31
  29. job_shop_lib/visualization/_disjunctive_graph.py +0 -210
  30. /job_shop_lib/visualization/{_agent_task_graph.py → _plot_agent_task_graph.py} +0 -0
  31. {job_shop_lib-1.0.0a3.dist-info → job_shop_lib-1.0.0a4.dist-info}/LICENSE +0 -0
  32. {job_shop_lib-1.0.0a3.dist-info → job_shop_lib-1.0.0a4.dist-info}/WHEEL +0 -0
@@ -17,36 +17,58 @@ class GeneralInstanceGenerator(InstanceGenerator):
17
17
  durations, and more.
18
18
 
19
19
  The class supports both single instance generation and iteration over
20
- multiple instances, controlled by the `iteration_limit` parameter. It
21
- implements the iterator protocol, allowing it to be used in a `for` loop.
20
+ multiple instances, controlled by the ``iteration_limit`` parameter. It
21
+ implements the iterator protocol, allowing it to be used in a ``for`` loop.
22
22
 
23
23
  Note:
24
24
  When used as an iterator, the generator will produce instances until it
25
- reaches the specified `iteration_limit`. If `iteration_limit` is None,
26
- it will continue indefinitely.
25
+ reaches the specified ``iteration_limit``. If ``iteration_limit`` is
26
+ ``None``, it will continue indefinitely.
27
27
 
28
28
  Attributes:
29
29
  num_jobs_range:
30
30
  The range of the number of jobs to generate. If a single
31
- int is provided, it is used as both the minimum and maximum.
31
+ ``int`` is provided, it is used as both the minimum and maximum.
32
32
  duration_range:
33
33
  The range of durations for each operation.
34
34
  num_machines_range:
35
35
  The range of the number of machines available. If a
36
- single int is provided, it is used as both the minimum and maximum.
36
+ single ``int`` is provided, it is used as both the minimum and
37
+ maximum.
37
38
  machines_per_operation:
38
39
  Specifies how many machines each operation
39
- can be assigned to. If a single int is provided, it is used for
40
+ can be assigned to. If a single ``int`` is provided, it is used for
40
41
  all operations.
41
42
  allow_less_jobs_than_machines:
42
- If True, allows generating instances where the number of jobs is
43
- less than the number of machines.
43
+ If ``True``, allows generating instances where the number of jobs
44
+ is less than the number of machines.
44
45
  allow_recirculation:
45
- If True, a job can visit the same machine more than once.
46
+ If ``True``, a job can visit the same machine more than once.
46
47
  name_suffix:
47
48
  A suffix to append to each instance's name for identification.
48
49
  seed:
49
50
  Seed for the random number generator to ensure reproducibility.
51
+
52
+ Args:
53
+ num_jobs:
54
+ The range of the number of jobs to generate.
55
+ num_machines:
56
+ The range of the number of machines available.
57
+ duration_range:
58
+ The range of durations for each operation.
59
+ allow_less_jobs_than_machines:
60
+ Allows instances with fewer jobs than machines.
61
+ allow_recirculation:
62
+ Allows jobs to visit the same machine multiple times.
63
+ machines_per_operation:
64
+ Specifies how many machines each operation can be assigned to.
65
+ If a single ``int`` is provided, it is used for all operations.
66
+ name_suffix:
67
+ Suffix for instance names.
68
+ seed:
69
+ Seed for the random number generator.
70
+ iteration_limit:
71
+ Maximum number of instances to generate in iteration mode.
50
72
  """
51
73
 
52
74
  def __init__( # pylint: disable=too-many-arguments
@@ -61,29 +83,6 @@ class GeneralInstanceGenerator(InstanceGenerator):
61
83
  seed: int | None = None,
62
84
  iteration_limit: int | None = None,
63
85
  ):
64
- """Initializes the instance generator with the given parameters.
65
-
66
- Args:
67
- num_jobs:
68
- The range of the number of jobs to generate.
69
- num_machines:
70
- The range of the number of machines available.
71
- duration_range:
72
- The range of durations for each operation.
73
- allow_less_jobs_than_machines:
74
- Allows instances with fewer jobs than machines.
75
- allow_recirculation:
76
- Allows jobs to visit the same machine multiple times.
77
- machines_per_operation:
78
- Specifies how many machines each operation can be assigned to.
79
- If a single int is provided, it is used for all operations.
80
- name_suffix:
81
- Suffix for instance names.
82
- seed:
83
- Seed for the random number generator.
84
- iteration_limit:
85
- Maximum number of instances to generate in iteration mode.
86
- """
87
86
  super().__init__(
88
87
  num_jobs=num_jobs,
89
88
  num_machines=num_machines,
@@ -153,7 +152,7 @@ class GeneralInstanceGenerator(InstanceGenerator):
153
152
  Args:
154
153
  available_machines:
155
154
  A list of available machine_ids to choose from.
156
- If None, all machines are available.
155
+ If ``None``, all machines are available.
157
156
  """
158
157
  duration = random.randint(*self.duration_range)
159
158
 
@@ -32,6 +32,20 @@ class InstanceGenerator(abc.ABC):
32
32
  A suffix to append to each instance's name for identification.
33
33
  seed:
34
34
  Seed for the random number generator to ensure reproducibility.
35
+
36
+ Args:
37
+ num_jobs:
38
+ The range of the number of jobs to generate.
39
+ num_machines:
40
+ The range of the number of machines available.
41
+ duration_range:
42
+ The range of durations for each operation.
43
+ name_suffix:
44
+ Suffix for instance names.
45
+ seed:
46
+ Seed for the random number generator.
47
+ iteration_limit:
48
+ Maximum number of instances to generate in iteration mode.
35
49
  """
36
50
 
37
51
  def __init__( # pylint: disable=too-many-arguments
@@ -43,23 +57,6 @@ class InstanceGenerator(abc.ABC):
43
57
  seed: int | None = None,
44
58
  iteration_limit: int | None = None,
45
59
  ):
46
- """Initializes the instance generator with the given parameters.
47
-
48
- Args:
49
- num_jobs:
50
- The range of the number of jobs to generate.
51
- num_machines:
52
- The range of the number of machines available.
53
- duration_range:
54
- The range of durations for each operation.
55
- name_suffix:
56
- Suffix for instance names.
57
- seed:
58
- Seed for the random number generator.
59
- iteration_limit:
60
- Maximum number of instances to generate in iteration mode.
61
- """
62
-
63
60
  if isinstance(num_jobs, int):
64
61
  num_jobs = (num_jobs, num_jobs)
65
62
  if isinstance(num_machines, int):
@@ -111,7 +111,17 @@ class AddDurationNoise(Transformation):
111
111
 
112
112
  class RemoveJobs(Transformation):
113
113
  """Removes jobs randomly until the number of jobs is within a specified
114
- range."""
114
+ range.
115
+
116
+ Args:
117
+ min_jobs:
118
+ The minimum number of jobs to remain in the instance.
119
+ max_jobs:
120
+ The maximum number of jobs to remain in the instance.
121
+ target_jobs:
122
+ If specified, the number of jobs to remain in the
123
+ instance. Overrides ``min_jobs`` and ``max_jobs``.
124
+ """
115
125
 
116
126
  def __init__(
117
127
  self,
@@ -120,13 +130,6 @@ class RemoveJobs(Transformation):
120
130
  target_jobs: int | None = None,
121
131
  suffix: str | None = None,
122
132
  ):
123
- """
124
- Args:
125
- min_jobs: The minimum number of jobs to remain in the instance.
126
- max_jobs: The maximum number of jobs to remain in the instance.
127
- target_jobs: If specified, the number of jobs to remain in the
128
- instance. Overrides min_jobs and max_jobs.
129
- """
130
133
  if suffix is None:
131
134
  suffix = f"_jobs={min_jobs}-{max_jobs}"
132
135
  super().__init__(suffix=suffix)
@@ -7,6 +7,7 @@ The main classes and functions available in this package are:
7
7
  Node
8
8
  NodeType
9
9
  build_disjunctive_graph
10
+ build_solved_disjunctive_graph
10
11
  build_agent_task_graph
11
12
  build_complete_agent_task_graph
12
13
  build_agent_task_graph_with_jobs
@@ -18,6 +19,7 @@ from job_shop_lib.graphs._node import Node
18
19
  from job_shop_lib.graphs._job_shop_graph import JobShopGraph, NODE_ATTR
19
20
  from job_shop_lib.graphs._build_disjunctive_graph import (
20
21
  build_disjunctive_graph,
22
+ build_solved_disjunctive_graph,
21
23
  add_disjunctive_edges,
22
24
  add_conjunctive_edges,
23
25
  add_source_sink_nodes,
@@ -62,4 +64,5 @@ __all__ = [
62
64
  "add_global_node",
63
65
  "add_machine_global_edges",
64
66
  "add_job_global_edges",
67
+ "build_solved_disjunctive_graph",
65
68
  ]
@@ -18,14 +18,15 @@ each disjunctive edge such that the overall processing time is minimized.
18
18
 
19
19
  import itertools
20
20
 
21
- from job_shop_lib import JobShopInstance
21
+ from job_shop_lib import JobShopInstance, Schedule
22
22
  from job_shop_lib.graphs import JobShopGraph, EdgeType, NodeType, Node
23
23
 
24
24
 
25
25
  def build_disjunctive_graph(instance: JobShopInstance) -> JobShopGraph:
26
26
  """Builds and returns a disjunctive graph for the given job shop instance.
27
27
 
28
- This function creates a complete disjunctive graph from a JobShopInstance.
28
+ This function creates a complete disjunctive graph from a
29
+ :JobShopInstance.
29
30
  It starts by initializing a JobShopGraph object and proceeds by adding
30
31
  disjunctive edges between operations using the same machine, conjunctive
31
32
  edges between successive operations in the same job, and finally, special
@@ -40,7 +41,7 @@ def build_disjunctive_graph(instance: JobShopInstance) -> JobShopGraph:
40
41
  the graph.
41
42
 
42
43
  Returns:
43
- JobShopGraph: A JobShopGraph object representing the disjunctive graph
44
+ A :class:`JobShopGraph` object representing the disjunctive graph
44
45
  of the job shop scheduling problem.
45
46
  """
46
47
  graph = JobShopGraph(instance)
@@ -51,6 +52,43 @@ def build_disjunctive_graph(instance: JobShopInstance) -> JobShopGraph:
51
52
  return graph
52
53
 
53
54
 
55
+ def build_solved_disjunctive_graph(schedule: Schedule) -> JobShopGraph:
56
+ """Builds and returns a disjunctive graph for the given solved schedule.
57
+
58
+ This function constructs a disjunctive graph from the given schedule,
59
+ keeping only the disjunctive edges that represent the chosen ordering
60
+ of operations on each machine as per the solution schedule.
61
+
62
+ Args:
63
+ schedule (Schedule): The solved schedule that contains the sequencing
64
+ of operations on each machine.
65
+
66
+ Returns:
67
+ A JobShopGraph object representing the disjunctive graph
68
+ of the solved job shop scheduling problem.
69
+ """
70
+ # Build the base disjunctive graph from the job shop instance
71
+ graph = JobShopGraph(schedule.instance)
72
+ add_conjunctive_edges(graph)
73
+ add_source_sink_nodes(graph)
74
+ add_source_sink_edges(graph)
75
+
76
+ # Iterate over each machine and add only the edges that match the solution
77
+ # order
78
+ for machine_schedule in schedule.schedule:
79
+ for i, scheduled_operation in enumerate(machine_schedule):
80
+ if i + 1 >= len(machine_schedule):
81
+ break
82
+ next_scheduled_operation = machine_schedule[i + 1]
83
+ graph.add_edge(
84
+ scheduled_operation.operation.operation_id,
85
+ next_scheduled_operation.operation.operation_id,
86
+ type=EdgeType.DISJUNCTIVE,
87
+ )
88
+
89
+ return graph
90
+
91
+
54
92
  def add_disjunctive_edges(graph: JobShopGraph) -> None:
55
93
  """Adds disjunctive edges to the graph."""
56
94
 
@@ -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, removes completed machine nodes from the graph.
28
+ If ``True``, removes completed machine nodes from the graph.
29
29
  remove_completed_job_nodes:
30
- If True, removes completed job nodes from the graph.
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
- """Package for reinforcement learning components."""
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
- - 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).
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
- - "feature_names": The names of the features in the
313
- observation.
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)