labscheduler.structures module

Here we define the structures of a process, a scheduling instance etc.

class labscheduler.structures.JSSP(operations: Iterable[Operation], machines: list[Machine])[source]

Bases: object

An instance of a special operation shop problem

_dummys: list[str]
add_dummys()[source]

Utility function adding dummy nodes to ensure solvability of truncated workflows

create_wfg() DiGraph[source]

Utility function creating a networkx graph of the problems workflow :return: A directed graph of type networkx.DiGraph

is_dummy(op: Operation) bool[source]

Utilitxy function to check whether an operation is an artificial node (dummy) :param op: :return:

machine_collection: MachineCollection
operations_by_id: dict[str, Operation]
remove_dummys(schedule: dict[str, ScheduledAssignment])[source]

Utility function removing the dummy nodes which are created to ensure solveability of truncated workflows :param schedule:

start_occupations() dict[str, int][source]

Utility function to extract the initial occupation of all machines before the processes start

start_operation_ids() list[str][source]

Utility function to get all operations that have no precedence constraints :return:

property wfg: DiGraph
class labscheduler.structures.Machine(name: str, type: str, max_capacity: int, min_capacity: int = 1, process_capacity: int = 1, allows_overlap: bool = False)[source]

Bases: object

Container for a machine.

Parameters:
  • name – The name of the machine.

  • type – The type of the machine.

  • max_capacity – The maximum number of labware this machine can hold.

  • min_capacity – The minimum number of labware, this machine has to hold to be operational

  • process_capacity – The maximum number of operations this machine can do at a time.

  • allows_overlap – Whether operations, that have overlapping but not identical execution_time are allowed.

allows_overlap: bool = False
max_capacity: int
min_capacity: int = 1
name: str
process_capacity: int = 1
type: str
class labscheduler.structures.MachineCollection(machines: list[Machine])[source]

Bases: object

This class is defined by just the list of available machines, but provides certain utilities

dump: Machine
machine_by_class: dict[str, list[Machine]]
machine_by_id: dict[str, Machine]
machine_class_sizes: dict[str, int]
min_capacity_machines: dict[str, Machine]
n_machine_classes: int
n_machines: int
class labscheduler.structures.MoveOperation(name: str, duration: float, start: ~datetime.datetime | None = None, finish: ~datetime.datetime | None = None, preceding_operations: list[str] = <factory>, required_machines: list[~labscheduler.structures.RequiredMachine] = <factory>, wait_cost: dict[str, float] = <factory>, max_wait: dict[str, int] = <factory>, min_wait: dict[str, int] = <factory>, wait_to_start_costs: float = 0.5, pref_dest_pos: int | None = None, destination_pos: int = 0, origin_pos: int = 0)[source]

Bases: Operation

Operation resembling a movement of a container

destination_pos: int = 0
property origin_machine: RequiredMachine | None
origin_pos: int = 0
pref_dest_pos: int | None = None
property target_machine: RequiredMachine | None
class labscheduler.structures.Operation(name: str, duration: float, start: ~datetime.datetime | None = None, finish: ~datetime.datetime | None = None, preceding_operations: list[str] = <factory>, required_machines: list[~labscheduler.structures.RequiredMachine] = <factory>, wait_cost: dict[str, float] = <factory>, max_wait: dict[str, int] = <factory>, min_wait: dict[str, int] = <factory>, wait_to_start_costs: float = 0.5)[source]

Bases: object

Editable data collection for a general operations in a workflow.

duration: float
finish: datetime | None = None
property main_machine: RequiredMachine | None
max_wait: dict[str, int]
min_wait: dict[str, int]
name: str
preceding_operations: list[str]
required_machines: list[RequiredMachine]
start: datetime | None = None
wait_cost: dict[str, float]
wait_to_start_costs: float = 0.5
class labscheduler.structures.RequiredMachine(type: str, tag: str, preferred: str | None = None)[source]

Bases: NamedTuple

Container for a requirement of an operation

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {'preferred': None}
_fields = ('type', 'tag', 'preferred')
classmethod _make(iterable)

Make a new RequiredMachine object from a sequence or iterable

_replace(**kwds)

Return a new RequiredMachine object replacing specified fields with new values

preferred: str | None

Alias for field number 2

tag: str

Alias for field number 1

type: str

Alias for field number 0

class labscheduler.structures.ScheduledAssignment(start: ~datetime.datetime, machine_precedences: list[str] = <factory>, machines_to_use: dict[str, str] = <factory>)[source]

Bases: object

Every operation is assigned this data in a schedule

machine_precedences: list[str]
machines_to_use: dict[str, str]
start: datetime
class labscheduler.structures.SolutionQuality(*values)[source]

Bases: Enum

FEASIBLE = 2
INFEASIBLE = 3
OPTIMAL = 1