jobshoplab.state_machine package

Subpackages

Submodules

jobshoplab.state_machine.time_machines module

Time advancement mechanisms for the JobShopLab state machine.

This module contains “time machine” functions that control how time advances in the discrete event simulation. These functions determine whether to advance time and by how much, based on the current state of the system and the availability of possible actions/events.

jump_by_one(loglevel, current_time, *args, **kwargs)[source]

Advance simulation time by exactly one time unit.

This simple time machine increases the current time by one unit, regardless of when the next event is scheduled. It provides a fixed time increment approach to simulation advancement.

Parameters:
loglevel : int | str

The log level for diagnostic messages

current_time : Time | NoTime

The current simulation time

*args : Any

Additional arguments (not used)

**kwargs : Any

Additional keyword arguments (not used)

Returns:

The new time after advancing by one unit

Return type:

Time

jump_to_event(loglevel, instance_config, current_time, job_states, machine_states, transport_states, buffer_states, *args, **kwargs)[source]

Advance time to the next event only if no operations are possible at current time.

This time machine implements a “lazy” time advancement strategy. It first checks if any operations are possible at the current time step. If operations are possible, it doesn’t advance time, allowing those operations to be processed. If no operations are possible, it advances time to the next scheduled event.

This approach ensures the simulation doesn’t skip over time points where actions could be taken, while efficiently jumping ahead when nothing can happen.

Parameters:
loglevel : int | str

The log level for diagnostic messages

instance_config : InstanceConfig

The instance configuration containing problem setup

current_time : Time | NoTime

The current simulation time

job_states : tuple[JobState, ...]

Current states of all jobs in the system

machine_states : tuple[MachineState, ...]

Current states of all machines in the system

transport_states : tuple[TransportState, ...]

Current states of all transports in the system

buffer_states : tuple[BufferState, ...]

Current states of all buffers in the system

*args : Any

Additional arguments (not used)

**kwargs : Any

Additional keyword arguments (not used)

Returns:

  • The unchanged current time if operations are possible now

  • The time of the next event if no operations are possible now

  • FailTime if no valid time advancement can be determined

Return type:

Time | FailTime

force_jump_to_event(loglevel, current_time, job_states, transport_states, *args, **kwargs)[source]

Unconditionally advance time to the next scheduled event.

This time machine identifies the next event that will occur in the simulation by examining all processing operations and active transports. It then advances time directly to the earliest scheduled event, skipping any “empty” time periods.

The function handles four cases: 1. No active jobs or transports: advance by one time unit 2. Both active jobs and transports: jump to whichever finishes first 3. Only active jobs: jump to the earliest job completion 4. Only active transports: jump to the earliest transport completion

Parameters:
loglevel : int | str

The log level for diagnostic messages

current_time : Time | NoTime

The current simulation time

job_states : Sequence[JobState]

Current states of all jobs in the system

transport_states : Sequence[TransportState]

Current states of all transports in the system

*args : Any

Additional arguments (not used)

**kwargs : Any

Additional keyword arguments (not used)

Returns:

  • The time of the next event

  • FailTime if no valid time advancement can be determined

Return type:

Time | FailTime

Module contents