ware_ops_algos.algorithms.routing

Submodules

Attributes

Classes

Algorithm

Abstract base class for all algorithms (routing, batching, etc.).

RoutingSolution

Route

PickPosition

RouteNode

NodeType

Create a collection of name/value pairs.

CombinedRoutingSolution

Resource

OrderPosition

Article

StorageLocations

Helper class that provides a standard way to create an ABC using

Routing

Abstract base class for all algorithms (routing, batching, etc.).

HeuristicRouting

Base class for heuristic routing algorithms.

SShapeRouting

Implements S-shape routing.

ReturnRouting

Implements Return routing.

MidpointRouting

Implements Midpoint routing.

LargestGapRouting

Implements Largest Gap Routing for order picking in a warehouse.

NearestNeighbourhoodRouting

A class to perform nearest neighbourhood routing for order picking in a warehouse using Dijkstra's algorithm.

PickListRouting

Base class for heuristic routing algorithms.

ExactRouting

Base class for exact routing algorithms.

ExactTSPRouting

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP).

ExactTSPRoutingDistance

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP) using distance as the objective.

ExactTSPRoutingDistanceWithWeightPrecedence

Implements the exact routing algorithm for TSP with weight-based precedence constraints.

ExactTSPRoutingTime

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP) using time as the objective.

ExactTSPRoutingMaxCompletionTime

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP) using maximum completion time as the objective.

RatliffRosenthalRouting

Dynamic Programming based approach to solve the picker routing problem in a single-block, parallel-aisle warehouse.

RatliffRosenthalScatteredRouting

Dynamic Programming based approach to solve the picker routing problem in a single-block,

Package Contents

class ware_ops_algos.algorithms.routing.Algorithm(seed: int | None = None)[source]

Bases: abc.ABC, Generic[I, O]

Abstract base class for all algorithms (routing, batching, etc.). Handles timing, algo naming, and ensures consistent result metadata.

algo_name: str = 'Algorithm'
logger
solve(input_data: I) O[source]
class ware_ops_algos.algorithms.routing.RoutingSolution[source]

Bases: AlgorithmSolution

route: Route | None = None
class ware_ops_algos.algorithms.routing.Route[source]
route: list[tuple[int, int]] | None = None
item_sequence: list[tuple[int, int]] | None = None
distance: float = 0.0
pick_list: PickList | None = None
annotated_route: list[RouteNode] | None = None
class ware_ops_algos.algorithms.routing.PickPosition[source]
order_number: int
article_id: int
amount: int
pick_node: tuple[int, int]
in_store: int
article_name: str | None = None
picked: bool | None = None
class ware_ops_algos.algorithms.routing.RouteNode[source]

Bases: NamedTuple

position: tuple[int, int]
node_type: NodeType
class ware_ops_algos.algorithms.routing.NodeType(*args, **kwds)[source]

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

PICK
ROUTE
class ware_ops_algos.algorithms.routing.CombinedRoutingSolution[source]

Bases: AlgorithmSolution

routes: list[Route] | None = None
class ware_ops_algos.algorithms.routing.Resource[source]
id: int
capacity: int | None = None
speed: float | None = None
time_per_pick: float | None = None
pick_cart: PickCart | None = None
tpe: ResourceType
tour_setup_time: float = None
occupied: bool | None = None
current_location: tuple[float, float] | None = None
class ware_ops_algos.algorithms.routing.OrderPosition[source]
order_number: int
article_id: int
amount: int
article_name: str | None = None
static from_dict(order_number: int, data: dict) OrderPosition[source]
class ware_ops_algos.algorithms.routing.Article[source]
article_id: int
article_name: str | None = None
weight: float | None = None
volume: float | None = None
to_dict() dict[str, Any][source]
class ware_ops_algos.algorithms.routing.StorageLocations[source]

Bases: ware_ops_algos.domain_models.BaseDomainObject

Helper class that provides a standard way to create an ABC using inheritance.

tpe: StorageType
locations: list[Location] | None = None
storage_slots: list[StorageLocation] | None = None
article_location_mapping: dict[int, list[Location]] | None
location_article_mapping: dict[tuple[int | float, int | float], int] | None
build_article_location_mapping()[source]
get_locations_by_article_id(article_id: int) list[Location][source]
get_features() dict[str, Any][source]
ware_ops_algos.algorithms.routing.equivalence_classes = [('U', 'U', '1C'), ('E', '0', '1C'), ('0', 'E', '1C'), ('E', 'E', '1C'), ('E', 'E', '2C'), ('0',...[source]
ware_ops_algos.algorithms.routing.cross_aisle_mapping[source]
ware_ops_algos.algorithms.routing.table_I[source]
ware_ops_algos.algorithms.routing.table_II[source]
ware_ops_algos.algorithms.routing.aisle_mapping[source]
class ware_ops_algos.algorithms.routing.Routing(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, picker: list[ware_ops_algos.domain_models.Resource], gen_tour: bool = False, gen_item_sequence: bool = False, node_list: list[tuple[float, float]] = None, node_to_idx: dict = None, idx_to_node: dict = None, distance_matrix: pandas.DataFrame | None = None, predecessor_matrix: numpy.array = None, **kwargs)[source]

Bases: ware_ops_algos.algorithms.algorithm.Algorithm[list[ware_ops_algos.algorithms.algorithm.PickPosition]| list[ware_ops_algos.domain_models.OrderPosition], ware_ops_algos.algorithms.algorithm.RoutingSolution], abc.ABC

Abstract base class for all algorithms (routing, batching, etc.). Handles timing, algo naming, and ensures consistent result metadata.

start_node
end_node
closest_node_to_start
min_aisle_position
max_aisle_position
pick_list: list[ware_ops_algos.algorithms.algorithm.PickPosition] | None = None
distance_matrix = None
predecessor_matrix = None
node_list: list[tuple[float, float]] = None
node_to_idx = None
idx_to_node = None
gen_item_sequence = False
gen_tour = False
item_sequence = []
route = []
annotated_route: list[ware_ops_algos.algorithms.algorithm.RouteNode] = []
distance = 0
current_order: list[ware_ops_algos.algorithms.algorithm.PickPosition] | None = None
picker
execution_time = None
reset_parameters()[source]
class ware_ops_algos.algorithms.routing.HeuristicRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, fixed_depot=True, **kwargs)[source]

Bases: Routing, abc.ABC

Base class for heuristic routing algorithms.

fixed_depot = True
class ware_ops_algos.algorithms.routing.SShapeRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, fixed_depot=True, **kwargs)[source]

Bases: HeuristicRouting

Implements S-shape routing.

algo_name = 'SShapeRouting'
class ware_ops_algos.algorithms.routing.ReturnRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, fixed_depot=True, **kwargs)[source]

Bases: HeuristicRouting

Implements Return routing.

algo_name = 'ReturnRouting'
class ware_ops_algos.algorithms.routing.MidpointRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, fixed_depot=True, **kwargs)[source]

Bases: HeuristicRouting

Implements Midpoint routing.

algo_name = 'MidpointRouting'
static split_orders_by_pickzone(resolved_positions, mid_point: int) tuple[list[ware_ops_algos.algorithms.algorithm.PickPosition], list[ware_ops_algos.algorithms.algorithm.PickPosition]][source]
class ware_ops_algos.algorithms.routing.LargestGapRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, fixed_depot=True, **kwargs)[source]

Bases: HeuristicRouting

Implements Largest Gap Routing for order picking in a warehouse.

algo_name = 'LargestGapRouting'
class ware_ops_algos.algorithms.routing.NearestNeighbourhoodRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, fixed_depot=True, **kwargs)[source]

Bases: HeuristicRouting

A class to perform nearest neighbourhood routing for order picking in a warehouse using Dijkstra’s algorithm.

algo_name = 'NearestNeighbourhoodRouting'
class ware_ops_algos.algorithms.routing.PickListRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, distance_matrix, predecessor_matrix, picker, **kwargs)[source]

Bases: HeuristicRouting

Base class for heuristic routing algorithms.

algo_name = 'PickListRouting'
class ware_ops_algos.algorithms.routing.ExactRouting(start_node: tuple[int, int], end_node: tuple[int, int], distance_matrix: pandas.DataFrame, predecessor_matrix: dict, picker: list[ware_ops_algos.domain_models.Resource], big_m, set_time_limit, **kwargs)[source]

Bases: Routing, abc.ABC

Base class for exact routing algorithms.

big_m
time_limit
length = None
pick_nodes = None
mdl = None
amount_at_pick_nodes = None
class ware_ops_algos.algorithms.routing.ExactTSPRouting(start_node: tuple[int, int], end_node: tuple[int, int], distance_matrix: pandas.DataFrame, predecessor_matrix: dict, picker: list[ware_ops_algos.domain_models.Resource], big_m, set_time_limit, **kwargs)[source]

Bases: ExactRouting

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP).

T = None
C_max = None
x = None
x_start = None
x_end = None
construct_route_and_item_sequence()[source]

Generates the route for the exact routing algorithm from solution variables.

class ware_ops_algos.algorithms.routing.ExactTSPRoutingDistance(start_node: tuple[int, int], end_node: tuple[int, int], distance_matrix: pandas.DataFrame, predecessor_matrix: numpy.array, picker: list[ware_ops_algos.domain_models.Resource], gen_tour, gen_item_sequence, big_m=1000, set_time_limit=300, **kwargs)[source]

Bases: ExactTSPRouting

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP) using distance as the objective.

algo_name = 'ExactTSPRoutingDistance'
class ware_ops_algos.algorithms.routing.ExactTSPRoutingDistanceWithWeightPrecedence(start_node: tuple[int, int], end_node: tuple[int, int], distance_matrix: pandas.DataFrame, predecessor_matrix: numpy.array, picker: list[ware_ops_algos.domain_models.Resource], gen_tour, gen_item_sequence, articles: list[ware_ops_algos.domain_models.Article], big_m=1000, set_time_limit=300, **kwargs)[source]

Bases: ExactTSPRouting

Implements the exact routing algorithm for TSP with weight-based precedence constraints. Heavy items must be picked before lighter items.

algo_name = 'ExactTSPRoutingDistanceWithWeightPrecedence'
articles
weights = []
class ware_ops_algos.algorithms.routing.ExactTSPRoutingTime(start_node: tuple[int, int], end_node: tuple[int, int], distance_matrix: pandas.DataFrame, predecessor_matrix: dict, picker: list[ware_ops_algos.domain_models.Resource], gen_tour, gen_item_sequence, big_m, set_time_limit, **kwargs)[source]

Bases: ExactTSPRouting

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP) using time as the objective.

algo_name = 'ExactTSPRouting'
travel_time_matrix
class ware_ops_algos.algorithms.routing.ExactTSPRoutingMaxCompletionTime(batched_list, distance_matrix, tour_matrix, picker, big_m, objective, **kwargs)[source]

Bases: ExactTSPRouting

Implements the exact routing algorithm for the Traveling Salesman Problem (TSP) using maximum completion time as the objective.

algo_name = 'ExactTSPRoutingMaxCompletionTime'
class ware_ops_algos.algorithms.routing.RatliffRosenthalRouting(start_node: tuple[int, int], end_node: tuple[int, int], closest_node_to_start: tuple[int, int], min_aisle_position: int, max_aisle_position: int, picker: list[ware_ops_algos.domain_models.Resource], n_aisles: int, n_pick_locations: int, dist_aisle: float, dist_pick_locations: float, dist_aisle_location: float, dist_start: float, dist_end: float, gen_tour: bool = False, gen_item_sequence: bool = False, **kwargs)[source]

Bases: Routing

Dynamic Programming based approach to solve the picker routing problem in a single-block, parallel-aisle warehouse.

Based on:

Katrin Heßler, Stefan Irnich (2024) Exact Solution of the Single-Picker Routing Problem with Scattered Storage. INFORMS Journal on Computing 36(6):1417-1435. https://doi.org/10.1287/ijoc.2023.0075

algo_name = 'RatliffRosenthalRouting'
state_graph
n_aisles
n_pick_locations
dist_aisle
dist_pick_locations
dist_aisle_location
dist_start
dist_end
depot
build_state_space()[source]
static largest_gap(order_list: list[ware_ops_algos.algorithms.algorithm.PickPosition])[source]
one_pass()[source]
two_pass()[source]
top(pick_node_y: int)[source]
bottom(pick_node_y: int)[source]
gap(gap_size: int)[source]
void()[source]
cross_aisle_cost(cross_aisle_action: tuple[int, int])[source]
cost_fn_wrapper(order_subset: list[ware_ops_algos.algorithms.algorithm.PickPosition], transition: str, node=None)[source]
get_item_sequence_from_path() list[ware_ops_algos.algorithms.algorithm.PickPosition][source]

Extracts the ordered pick sequence from the dynamic programming path (self.path). :returns: ordered item sequence along the optimal tour. :rtype: list[PickPosition]

plot_picker_tour(T: networkx.MultiGraph)[source]

Visualizes the picker tour graph T as a 2D warehouse layout. Nodes are (aisle, pick_y) positions.

class ware_ops_algos.algorithms.routing.RatliffRosenthalScatteredRouting(storage_locations: ware_ops_algos.domain_models.StorageLocations, *args, **kwargs)[source]

Bases: RatliffRosenthalRouting

Dynamic Programming based approach to solve the picker routing problem in a single-block, parallel-aisle warehouse with scattered storage.

Based on:

Katrin Heßler, Stefan Irnich (2024) Exact Solution of the Single-Picker Routing Problem with Scattered Storage. INFORMS Journal on Computing 36(6):1417-1435. https://doi.org/10.1287/ijoc.2023.0075

algo_name = 'RatliffRosenthalScattered'
storage_locations
state_graph: networkx.MultiDiGraph
demand: dict[int, int]
aisle_content: dict[int, list[dict]]
total_warehouse_supply: dict[int, int]
aisle_total_supply: dict[int, dict[int, int]]