job_shop_lib.graphs.graph_updaters¶
Contains classes and functions for updating the graph representation of the job shop scheduling problem.
Currently, the following classes and utilities are available:
|
Observer that builds and updates a job shop graph. |
|
Updates the residual graph based on the completed operations. |
|
Removes the operation node of the scheduled operation from the graph. |
- class GraphUpdater(dispatcher, job_shop_graph, *, subscribe=True)[source]¶
Bases:
DispatcherObserver
Observer that builds and updates a job shop graph.
This observer uses a provided graph builder function to initialize the job shop graph and a graph updater function to update the graph after each scheduled operation.
- Parameters:
dispatcher (Dispatcher)
job_shop_graph (JobShopGraph)
subscribe (bool)
- initial_job_shop_graph¶
The initial job shop graph. This is a copy of the graph that was received when the observer was created. It is used to reset the graph to its initial state.
- job_shop_graph¶
The current job shop graph. This is the graph that is updated after each scheduled operation.
- __init__(dispatcher, job_shop_graph, *, subscribe=True)[source]¶
Initializes the class.
- Parameters:
dispatcher (Dispatcher) -- The dispatcher instance to observe.
job_shop_graph (JobShopGraph) -- The job shop graph to update.
subscribe (bool) -- Whether to subscribe to the dispatcher. If
True
, the observer will subscribe to the dispatcher when it is initialized. IfFalse
, the observer will not subscribe to the dispatcher.
- abstract update(scheduled_operation)[source]¶
Updates the job shop graph after an operation has been dispatched.
- Parameters:
scheduled_operation (ScheduledOperation)
- Return type:
None
- remove_completed_operations(job_shop_graph, completed_operations)[source]¶
Removes the operation node of the scheduled operation from the graph.
- Parameters:
graph -- The job shop graph to update.
dispatcher -- The dispatcher instance.
job_shop_graph (JobShopGraph)
completed_operations (Iterable[Operation])
- Return type:
None
- class ResidualGraphUpdater(dispatcher, job_shop_graph, *, subscribe=True, remove_completed_machine_nodes=True, remove_completed_job_nodes=True)[source]¶
Bases:
GraphUpdater
Updates the residual graph based on the completed operations.
This observer updates the residual graph by removing the completed operation, machine and job nodes from the graph. It subscribes to the
IsCompletedObserver
to determine which operations, machines and jobs have been completed.- Parameters:
dispatcher (Dispatcher)
job_shop_graph (JobShopGraph)
subscribe (bool)
remove_completed_machine_nodes (bool)
remove_completed_job_nodes (bool)
- remove_completed_machine_nodes¶
If True, removes completed machine nodes from the graph.
- remove_completed_job_nodes¶
If True, removes completed job nodes from the graph.
- __init__(dispatcher, job_shop_graph, *, subscribe=True, remove_completed_machine_nodes=True, remove_completed_job_nodes=True)[source]¶
Initializes the residual graph updater.
- Parameters:
dispatcher (Dispatcher) -- The dispatcher instance to observe.
job_shop_graph (JobShopGraph) -- The job shop graph to update.
subscribe (bool) -- If True, automatically subscribes the observer to the dispatcher. Defaults to True.
remove_completed_machine_nodes (bool) -- If True, removes completed machine nodes from the graph. Defaults to True.
remove_completed_job_nodes (bool) -- If True, removes completed job nodes from the graph. Defaults to True.
- property is_completed_observer: IsCompletedObserver¶
~job_shop_lib.dispatching.feature_observers. IsCompletedObserver instance.
- Type:
Returns the
- Type:
class
- update(scheduled_operation)[source]¶
Updates the residual graph based on the completed operations.
- Parameters:
scheduled_operation (ScheduledOperation)
- Return type:
None