jobshoplab.utils.state_machine_utils package¶
Submodules¶
jobshoplab.utils.state_machine_utils.buffer_type_utils module¶
- get_buffer_config_by_id(buffers, buffer_id)[source]¶
Get a buffer config by its ID from a tuple of BufferConfig objects.
- Parameters:¶
- buffers : tuple[BufferConfig, ...]¶
A tuple of BufferConfig objects.
- buffer_id : str¶
The ID of the desired buffer.
- Returns:¶
The BufferConfig object with the specified ID.
- Return type:¶
- Raises:¶
InvalidValue – If the desired buffer is not found in the given tuple of buffers.
- is_job_in_buffer(buffer_state, job_id)[source]¶
Check if a job is in a buffer.
- put_in_buffer(buffer_state, buffer_config, job_state)[source]¶
Put a job in a buffer.
- Parameters:¶
- buffer_state : BufferState¶
The buffer to put the job in.
- job_state : JobState¶
The job to put in the buffer.
- buffer_config : BufferConfig¶
- Returns:¶
The updated buffer state.
- Return type:¶
- switch_buffer(instance, buffer_from_state, buffer_to_state, job_state)[source]¶
Switch a job from one buffer to another.
- Parameters:¶
- buffer_from_state : BufferState¶
The buffer to remove the job from.
- buffer_to_state : BufferState¶
The buffer to put the job in.
- job_state : JobState¶
The job to switch buffers.
- instance : InstanceConfig¶
- Returns:¶
The updated buffer states and job state.
- Return type:¶
- remove_from_buffer(buffer_state, job_id)[source]¶
Remove a job from a buffer.
- get_all_buffer_configs(instance)[source]¶
Get all buffer configurations from the instance configuration.
- Parameters:¶
- instance : InstanceConfig¶
The instance configuration.
- Returns:¶
A list of all buffer configurations.
- Return type:¶
- get_buffer_state_by_id(buffers, buffer_id)[source]¶
Get a buffer state by its ID from a tuple of BufferState objects.
- Parameters:¶
- buffers : tuple[BufferState, ...]¶
A tuple of BufferState objects.
- buffer_id : str¶
The ID of the desired buffer.
- Returns:¶
The BufferState object with the specified ID.
- Return type:¶
- Raises:¶
InvalidValue – If the desired buffer is not found in the given tuple of buffers.
jobshoplab.utils.state_machine_utils.component_type_utils module¶
jobshoplab.utils.state_machine_utils.core_utils module¶
- is_done(state)[source]¶
Check if the state machine is done. :param state: The current state of the state machine. :type state: State
- is_machine_transition_from_idle_to_setup(machine, transition)[source]¶
- Parameters:¶
- machine : MachineState¶
- is_machine_transition_from_setup_to_working(machine, transition)[source]¶
- Parameters:¶
- machine : MachineState¶
- is_machine_transition_from_working_to_outage(machine, transition)[source]¶
- Parameters:¶
- machine : MachineState¶
- is_machine_transition_from_outage_to_idle(machine, transition)[source]¶
- Parameters:¶
- machine : MachineState¶
- is_transport_transition_from_idle_to_working(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_pickup_to_transit(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_pickup_to_waitingpickup(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_waitingpickup_to_transit(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_working_to_outage(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_transit_to_outage(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_outage_to_idle(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- is_transport_transition_from_waiting_pickup_waiting_pickup(transport, transition)[source]¶
- Parameters:¶
- transport : TransportState¶
- sorted_by_transport(transitions)[source]¶
- Parameters:¶
- transitions : tuple[ComponentTransition, ...]¶
- Return type:¶
- create_transport_location_from_job(current_dest, pickup_dest, dropoff_dest)[source]¶
- sorted_done_operations(job_states)[source]¶
jobshoplab.utils.state_machine_utils.dispatch_rules_uitls module¶
- get_inbuffer_jobs_for_machine(instance, state, machine_id)[source]¶
- get_prebuffer_operations_for_machine(instance, state, machine_id)[source]¶
- find_job_state_from_operation(state, operation_id)[source]¶
- find_job_config_from_operation(instance, operation_id)[source]¶
- Parameters:¶
- instance : InstanceConfig¶
- operation_id : str¶
-
get_machine_prebuffer_jobs_by_processing_time(instance, state, mode=
'SPT'
)[source]¶ Gets jobs for machines based on the processing time of their next operation.
- Parameters:¶
- instance : InstanceConfig¶
- state : State¶
-
get_machine_jobs_by_remaining_processing_time(instance, state, mode=
'srpt'
)[source]¶ Assigns jobs to machines based on Shortest/Longest Remaining Processing Time.
- Parameters:¶
- instance : InstanceConfig¶
- state : State¶
- get_all_outbuffer_jobs(instance, state)[source]¶
Retrieves all jobs in outbuffer and postbuffer across machines.
- Parameters:¶
- instance : InstanceConfig¶
- state : State¶
- get_job_with_most_remaining_processing_time(instance, job_states)[source]¶
Returns the job with the most remaining processing time.
-
get_job_by_operation_count(job_states, find_max=
True
)[source]¶ Returns the job with the most or least remaining operations.
jobshoplab.utils.state_machine_utils.job_type_utils module¶
- get_job_config_by_id(jobs, job_id)[source]¶
Get a job config by its ID from a tuple of JobConfig objects.
- get_operation_state_by_id(jobs, operation_id)[source]¶
Get an operation by its ID from a tuple of JobState objects.
- get_operation_config_by_id(jobs, operation_id)[source]¶
Get an operation config by its ID from a tuple of JobConfig objects.
- get_next_not_done_operation(job)[source]¶
Get the next operation from a job.
- Parameters:¶
- Returns:¶
The next operation from the job.
- Return type:¶
- Raises:¶
InvalidValue – If the job has no more operations.
- get_next_idle_operation(job)[source]¶
Get the next operation from a job.
- Parameters:¶
- Returns:¶
The next operation from the job.
- Return type:¶
- Raises:¶
InvalidValue – If the job has no more operations.
- get_processing_operation(job)[source]¶
Get the active operation from a job.
- Parameters:¶
- Returns:¶
The active operation from the job.
- Return type:¶
- Raises:¶
InvalidValue – If the job has no active operations.
- group_operations_by_state(job_states)[source]¶
Group all operations from job states by their operation state state.
jobshoplab.utils.state_machine_utils.logisitcs_type_uitls module¶
jobshoplab.utils.state_machine_utils.machine_type_utils module¶
- get_machine_state_by_id(machines, machine_id)[source]¶
Get a machine by its ID from a tuple of MachineState objects.
- Parameters:¶
- machines : tuple[MachineState, ...]¶
A tuple of MachineState objects.
- machine_id : str¶
The ID of the desired machine.
- Returns:¶
The MachineState object with the specified ID.
- Return type:¶
- Raises:¶
InvalidValue – If the desired machine is not found in the given tuple of machines.
- get_machine_config_by_id(machine_configs, machine_id)[source]¶
Get a machine config by its ID from a tuple of MachineConfig objects.
- Parameters:¶
- machine_configs : tuple[MachineConfig, ...]¶
A tuple of MachineConfig objects.
- machine_id : str¶
The ID of the desired machine.
- Returns:¶
The MachineConfig object with the specified ID.
- Return type:¶
- Raises:¶
InvalidValue – If the desired machine config is not found in the given tuple of machine configs.
- get_machine_id_from_buffer(machine_configs, buffer_id)[source]¶
Get the Machine where the buffer is located.
Checks if buffer is prebuffer, postbuffer or buffer and returns the corresponding machine id.
- get_buffer_state_from_machine(machine_state, buffer_id)[source]¶
Get the buffer state from a machine state.
- replace_buffer_state_in_machine(machine_state, buffer_state)[source]¶
Update the buffer state in a machine state.
- Parameters:¶
- machine_state : MachineState¶
- buffer_state : BufferState¶
- Return type:¶
jobshoplab.utils.state_machine_utils.possible_transition_utils module¶
- is_job_next_operation_free(job_state)[source]¶
Checks if a operation at a job is possible -> Job is not finished -> Job is not active
- is_job_at_machine(job_state, machine_state)[source]¶
Check if a job is at a machine.
- Parameters:¶
- job_state : JobState¶
The job to check.
- machine : MachineState
The machine to check.
- machine_state : MachineState¶
- Returns:¶
True if the job is at the machine, False otherwise.
- Return type:¶
- is_action_possible(job_state, state, instance)[source]¶
Checks if a action at a job is possible -> Machine action -> Transport action
Returns: True if the operation is possible, False otherwise
- get_possible_transports(transport_states, transport_configs)[source]¶
Checks if the transport is possible
Returns: True if the transport is possible, False otherwise
- Parameters:¶
- transport_states : tuple[TransportState, ...]¶
- transport_configs : tuple[TransportTypeConfig, ...]¶
- Return type:¶
Generator[TransportState, None, None]
- get_num_possible_events(state, instance)[source]¶
Get the number of possible events
Returns: The number of possible events
- sort_by_id(components)[source]¶
- Parameters:¶
- components : tuple[JobState | TransportState, ...]¶
- Return type:¶
tuple[JobState | TransportState, …]
- get_possible_transport_transition(state, instance)[source]¶
Get all available transports and mach each transport with each possible job Jobs are possible when:
Job is in state working -> when finised it need to be transported to next op
Job is in state idle and next op is not the current location
Jobs that are not getting are already assigned to an agv
Returns: The tuple of possible ComponentTransitions
- get_possible_transitions(state, instance)[source]¶
Get all possible transitions for the state
- Return type:¶
- replace_machine_state(state, machine_state)[source]¶
- get_component_by_id(components, id)[source]¶
- replace_components(state, updated_components)[source]¶
jobshoplab.utils.state_machine_utils.transport_type_utils module¶
- get_transport_state_by_id(transports, transport_id)[source]¶
Get a transport by its ID from a tuple of TransportState objects.
- Parameters:¶
- transports : tuple[TransportState, ...]¶
A tuple of TransportState objects.
- transport_id : str¶
The ID of the desired transport.
- Returns:¶
The TransportState object with the specified ID.
- Return type:¶
- Raises:¶
InvalidValue – If the desired transport is not found in the given tuple of transports.
- get_transport_config_by_id(transports, transport_id)[source]¶
Get a transport by its ID from a tuple of TransportConfig objects.
- Parameters:¶
- transports : tuple[TransportConfig, ...]¶
A tuple of TransportConfig objects.
- transport_id : str¶
The ID of the desired transport.
- Returns:¶
The TransportConfig object with the specified ID.
- Return type:¶
- Raises:¶
InvalidValue – If the desired transport is not found in the given tuple of transports.
- group_transports_by_state(transports)[source]¶
Group all transports by their state.
- Parameters:¶
- transports : tuple[TransportState, ...]¶
A tuple of TransportState objects.
- Returns:¶
A dictionary with the transport state as the key and a tuple of transports as the value.
- Return type:¶
dict[str, tuple[TransportState, …]]