jobshoplab.utils package¶
Subpackages¶
- jobshoplab.utils.state_machine_utils package
- Submodules
- jobshoplab.utils.state_machine_utils.buffer_type_utils module
- jobshoplab.utils.state_machine_utils.component_type_utils module
- jobshoplab.utils.state_machine_utils.core_utils module
- print_state
- is_done
- no_processing_operations
- is_machine_transition_from_idle_to_setup
- is_machine_transition_from_setup_to_working
- is_machine_transition_from_working_to_outage
- is_machine_transition_from_outage_to_idle
- is_transport_transition_from_idle_to_working
- is_transport_transition_from_pickup_to_transit
- is_transport_transition_from_pickup_to_waitingpickup
- is_transport_transition_from_waitingpickup_to_transit
- is_transport_transition_from_working_to_outage
- is_transport_transition_from_transit_to_outage
- is_transport_transition_from_outage_to_idle
- is_transport_transition_from_waiting_pickup_waiting_pickup
- sorted_by_transport
- create_transport_location_from_job
- sorted_done_operations
- jobshoplab.utils.state_machine_utils.dispatch_rules_uitls module
- get_inbuffer_jobs_for_machine
- get_prebuffer_operations_for_machine
- find_job_state_from_operation
- find_job_config_from_operation
- get_machine_prebuffer_jobs_by_processing_time
- get_machine_jobs_by_remaining_processing_time
- get_all_outbuffer_jobs
- get_job_with_most_remaining_processing_time
- get_job_by_operation_count
- jobshoplab.utils.state_machine_utils.job_type_utils module
- jobshoplab.utils.state_machine_utils.logisitcs_type_uitls module
- jobshoplab.utils.state_machine_utils.machine_type_utils module
- jobshoplab.utils.state_machine_utils.possible_transition_utils module
- is_job_next_operation_free
- is_job_at_machine
- is_action_possible
- get_possible_transports
- get_num_possible_events
- sort_by_id
- get_possible_transport_transition
- get_possible_transitions
- replace_machine_state
- replace_job_state
- replace_transport_state
- replace_job_operation_state
- get_component_by_obj
- get_component_by_id
- get_component_by_id_and_type
- replace_component_by_id_and_type
- replace_component_by_obj
- replace_components
- jobshoplab.utils.state_machine_utils.transport_type_utils module
- Module contents
Submodules¶
jobshoplab.utils.dipatching_benchmark module¶
jobshoplab.utils.exceptions module¶
- exception NoJsspSpecified[source]¶
Bases:
JobShopException
- exception InvalidType[source]¶
Bases:
JobShopException
- __init__(key, value, expected_type)[source]¶
- exception NotImplementedError[source]¶
Bases:
JobShopException
- exception UnsuccessfulStateMachineResult[source]¶
Bases:
JobShopException
- exception ActionOutOfActionSpace[source]¶
Bases:
JobShopException
- __init__(action, action_space)[source]¶
- exception EnvDone[source]¶
Bases:
JobShopException
- exception MissingSpecificationError[source]¶
Bases:
JobShopException
- __init__(specification_name)[source]¶
- exception InvalidDurationError[source]¶
Bases:
JobShopException
-
__init__(value, expected_type=
'integer'
)[source]¶
-
__init__(value, expected_type=
- exception UnknownDistributionTypeError[source]¶
Bases:
JobShopException
- exception InvalidSetupTimesError[source]¶
Bases:
JobShopException
- __init__(machine_id)[source]¶
- exception ComponentAssociationError[source]¶
Bases:
JobShopException
- __init__(component_id, component_type)[source]¶
- exception MissingComponentError[source]¶
Bases:
JobShopException
- __init__(component_id, component_type)[source]¶
- exception InvalidOutageTypeError[source]¶
Bases:
JobShopException
- __init__(outage_type)[source]¶
- exception InvalidDispatchRuleError[source]¶
Bases:
JobShopException
- __init__(mode, allowed_modes)[source]¶
- exception OperationMachineMatchError[source]¶
Bases:
JobShopException
- __init__(operation_id, expected_machine, actual_machine)[source]¶
- exception MissingJobIdError[source]¶
Bases:
JobShopException
-
__init__(transition_type=
None
)[source]¶
-
__init__(transition_type=
- exception TransportJobError[source]¶
Bases:
JobShopException
-
__init__(transport_id, transport_job=
None
)[source]¶
-
__init__(transport_id, transport_job=
- exception MissingProcessingOperationError[source]¶
Bases:
JobShopException
- exception TransportConfigError[source]¶
Bases:
JobShopException
-
__init__(config_field, value=
None
)[source]¶
-
__init__(config_field, value=
- exception TravelTimeError[source]¶
Bases:
JobShopException
- __init__(source, destination)[source]¶
- exception InstanceSchemaError[source]¶
Bases:
JobShopException
- exception MissingRequiredFieldError[source]¶
Bases:
InstanceSchemaError
-
__init__(field_name, parent_field=
None
)[source]¶
-
__init__(field_name, parent_field=
- exception InvalidFieldValueError[source]¶
Bases:
InstanceSchemaError
-
__init__(field_name, value, expected_format=
None
)[source]¶
-
__init__(field_name, value, expected_format=
- exception JobSpecificationSyntaxError[source]¶
Bases:
InstanceSchemaError
-
__init__(line_number, line_content, details=
None
)[source]¶
-
__init__(line_number, line_content, details=
- exception IndexError[source]¶
Bases:
JobShopException
-
__init__(index, sequence_length=
None
)[source]¶
-
__init__(index, sequence_length=
- exception ConfigurationError[source]¶
Bases:
JobShopException
-
__init__(config_name, value=
None
, details=None
)[source]¶
-
__init__(config_name, value=
- exception InvalidTimeTypeError[source]¶
Bases:
JobShopException
-
__init__(actual_type, expected_types=
None
)[source]¶
-
__init__(actual_type, expected_types=
- exception InvalidSetupTimeTypeError[source]¶
Bases:
JobShopException
-
__init__(actual_type, expected_types=
None
)[source]¶
-
__init__(actual_type, expected_types=
jobshoplab.utils.load_config module¶
-
load_config(frozen=
True
, stub_file_path=PosixPath('/home/runner/work/jobshoplab/jobshoplab/jobshoplab/utils/load_config.py')
, config_path=PosixPath('data/config/config.yaml')
)[source]¶ Load the configuration from the specified directory and return a Config object.
- Parameters:¶
- Returns:¶
The loaded configuration object.
- Return type:¶
Config
- Raises:¶
FileNotFoundError – If the configuration file does not exist.
yaml.YAMLError – If there is an error parsing the YAML configuration file.
Note
CONFIG_YAML_PATH is a global variable that sets the path of your YAML config file.
jobshoplab.utils.logger module¶
- get_logger(name, loglevel, handler=<StreamHandler <stdout> (NOTSET)>)[source]¶
get a logger object with the given name and log level. matches various log levels and converts them to the corresponding logging level.
jobshoplab.utils.rich_cli module¶
- render_action(state_result)[source]¶
- Parameters:¶
- state_result : StateMachineResult¶
- render_possilbe_transitions(state_machine_result)[source]¶
- Parameters:¶
- state_machine_result : StateMachineResult¶
- render_machine_with_buffers(machine_state)[source]¶
Render a machine with its pre-buffer and post-buffer in a single row.
- render_standalone_buffers(state_machine_result)[source]¶
Render Buffer Overview.
- Parameters:¶
- state_machine_result : StateMachineResult¶
- render_shopfloor_overview(state_machine_result)[source]¶
Render all machines compactly.
- render_table(state_result)[source]¶
- Parameters:¶
- state_result : StateMachineResult¶
jobshoplab.utils.solutions module¶
- make_solution_action_sequence(dir)[source]¶
Create a solution action sequence. This function reads a file from the specified directory, processes its contents, and returns a tuple containing the machine, job, and start_time in each row. :param dir: The directory path to the file containing the solution data. :type dir: str
- group_by_time(tuples)[source]¶
Groups a list of tuples by their start time. :param tuples: A list where each tuple contains three elements:
machine: The machine identifier.
job: The job identifier.
start_time: The start time of the job on the machine.
- get_machine_job_time_sequence(sol_arr)[source]¶
Generator function that yields the machine-job-time sequence from a given solution array. :param sol_arr: A 2D list where each sublist represents a job and each element in the sublist
represents the time required on a specific machine.
- Yields:¶
tuple –
- A tuple containing the best machine index, best job index, and the lowest time found in the current iteration.
The best machine and job are the ones with the lowest processing time that hasn’t been processed yet.
- get_make_span(sol_seq, instance)[source]¶
Calculate the makespan (total completion time) for a solution sequence.
The makespan is the maximum end time of all last operations across all jobs. For each job’s last operation, find its corresponding entry in the solution sequence, calculate its end time, and return the maximum end time.
jobshoplab.utils.textual_cli module¶
jobshoplab.utils.utils module¶
- class ConfigProtocol[source]¶
Bases:
Protocol
Protocol defining the interface expected for config objects
- Config¶
alias of
ConfigProtocol
- get_args(logger, std_args, config, cfg_instance)[source]¶
Get the arguments by merging the standard arguments with the attributes of the config object.
- Parameters:¶
- Returns:¶
The merged arguments. to be used in the constructor of the object.
- Return type:¶
- Raises:¶
InvalidValue – If the config object is None or if it doesn’t have the required attribute.
- get_id_int(id)[source]¶
Extracts the integer part from an ID string.
- Parameters:¶
- Returns:¶
The extracted integer part of the ID.
- Return type:¶
- Raises:¶
InvalidValue – If the ID format is invalid.
Example
>>> get_id_int('a-123') '123'
# TODO: How to handle Operation -> o-1-2
- get_component_id_int(all_components, id)[source]¶
Get the integer index of a component in a list of components.
- max_machine_duration(schedule)[source]¶
Calculate the maximum total duration of operations on any machine.
- calculate_lower_bound2(schedule)[source]¶
Calculate a simple lower bound for the makespan as the maximum of: 1. The maximum total duration of any job 2. The maximum total duration of operations on any machine
- calculate_lower_bound(instance)[source]¶
lowerbound calculation implementation after taillard 1989 Benchmarks for basic scheduling problems. gives a rought estimate of the lower bound of the makespan of the instance. the estimate is allways less than the actual makespan. :param instance: The instance object. :type instance: object
- get_max_allowed_time(instance_config)[source]¶
Calculate the maximum allowed time for a given instance configuration.
This function computes the sum of the durations of all operations in the instance configuration. This sum represents the worst-case scenario for scheduling without any obvious mistakes.