jobshoplab.state_machine.core package

Subpackages

Submodules

jobshoplab.state_machine.core.transitions module

Transition definitions for the JobShopLab state machine.

This module defines the valid state transitions for various components (machines, transports, buffers) in the JobShopLab simulation. It implements a state machine pattern where each component type has its own set of allowed state transitions.

class StateEnum[source]

Bases: object

Enumeration of generalized component states for the state machine.

These states represent the common high-level states that different components can be in, abstracting away component-specific state details.

IDLE = 'Idle'
RUNNING = 'running'
OUTAGE = 'outage'
FULL = 'full'
EMPTY = 'empty'
SETUP = 'setup'
class Transition[source]

Bases: object

Base class for defining state transitions in the state machine.

This class provides the core functionality for validating state transitions by mapping component-specific states to general state categories and checking if transitions between these categories are allowed.

states

List of valid states for the component type

transitions

Dictionary mapping from states to allowed target states

__init__(states, transitions)[source]

Initialize a transition validator with states and valid transitions.

Parameters:
states

List of valid states for this component type

transitions

Dictionary mapping from states to tuples of valid target states

is_valid_transition(current_state, new_state)[source]

Check if a transition from current_state to new_state is valid.

Rules: 1. Self-transitions (to same state) are generally invalid 2. Exception: WAITINGPICKUP can transition to itself (to extend waiting) 3. The transition must be in the allowed transitions map

Parameters:
current_state

The current state of the component

new_state

The proposed new state for the component

Returns:

True if the transition is valid, False otherwise

Return type:

bool

class BufferTransition[source]

Bases: Transition

Defines valid state transitions for buffer components.

Buffers can transition between IDLE, EMPTY, FULL, and OUTAGE states according to the defined transition rules.

__init__()[source]

Initialize the buffer transition validator with buffer-specific rules.

class MachineTransition[source]

Bases: Transition

Defines valid state transitions for machine components.

Machines follow a specific cycle: 1. IDLE → SETUP: Machine prepares for processing a job 2. SETUP → RUNNING: Machine begins processing the job 3. RUNNING → OUTAGE: Machine finishes processing or encounters a failure 4. OUTAGE → IDLE: Machine becomes available again

__init__()[source]

Initialize the machine transition validator with machine-specific rules.

class TransportTransition[source]

Bases: Transition

Defines valid state transitions for transport components.

Transport components (like AGVs) follow a specific cycle: 1. IDLE → RUNNING: Transport starts moving to pick up or deliver a job 2. RUNNING → OUTAGE: Transport completes its movement task 3. OUTAGE → IDLE: Transport becomes available again

Transports can also transition from RUNNING to RUNNING (as in TRANSIT to WAITINGPICKUP).

__init__()[source]

Initialize the transport transition validator with transport-specific rules.

Module contents