# philippxxy/on-line-order-batching architecture

> Architecture diagram of the GitHub repository philippxxy/on-line-order-batching, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/philippxxy/on-line-order-batching
- Repository: https://github.com/philippxxy/on-line-order-batching

## Overview

This is a threaded CLI application for online order batching in a single-picker warehouse. The workflow is: configure warehouse and batching parameters, load orders and release them over time, optimize arrived orders into batches, then sequence and report the picking tour while coordinating picker availability. The README also documents configurable batch-selection rules and S-shape routing. The sampled excerpts establish the main thread, queue, and optimizer relationships; some core implementations are unsampled, so their internal wiring is shown only where module responsibilities or explicit calls support it.

Main entry points: [`src/core/logic_controller.py`](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic_controller.py) (Logic thread), [`src/ui/cli_controller.py`](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli_controller.py) (CLI thread), [`src/ui/cli/cli_runtime.py`](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_runtime.py) (Interactive runtime), [`src/main.py`](https://github.com/philippxxy/on-line-order-batching/blob/main/src/main.py) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI interaction"]
  node_initialize["Configure run<br/>[cli_initialize.py]"]
  node_cli_thread["CLI thread<br/>[cli_controller.py]"]
  node_runtime["Interactive runtime<br/>[cli_runtime.py]"]
  node_orders_source["Imported orders<br/>[imported_orders.py]"]
  node_batch_output["Batch and tour display<br/>[cli_runtime.py]"]
end

subgraph group_coord["Runtime coordination"]
  node_main["Program entry<br/>[main.py]"]
  node_logic_thread["Logic thread"]
  node_shared["Shared runtime state"]
  node_input_handler["Order and layout access<br/>[input_handler.py]"]
  node_warehouse_file["Warehouse layout CSV"]
  node_order_join["Join item positions"]
end

subgraph group_optimization["Batch optimization"]
  node_selector["Batch construction and selection<br/>[batch_selector.py]"]
  node_minimizer["Iterated local search"]
  node_pivot["Online release decisions<br/>[pivot_logic.py]"]
end

subgraph group_routing["Warehouse routing"]
  node_tour_calc["S-shape tour calculation"]
end

node_operator(("Warehouse operator"))

node_operator -->|"provides settings"| node_initialize
node_initialize -->|"returns configuration"| node_main
node_main -->|"starts thread"| node_cli_thread
node_main -->|"starts thread"| node_logic_thread
node_cli_thread -->|"runs"| node_runtime
node_orders_source -->|"supplies orders"| node_cli_thread
node_cli_thread -->|"queues released orders"| node_shared
node_runtime -->|"reads batch and picker state"| node_shared
node_logic_thread -->|"updates runtime state"| node_shared
node_logic_thread -->|"reads orders and settings"| node_input_handler
node_warehouse_file -->|"loads layout"| node_input_handler
node_input_handler -->|"joins item positions"| node_order_join
node_logic_thread -->|"optimizes arrived orders"| node_selector
node_selector -->|"improves batches"| node_minimizer
node_selector -->|"evaluates selection rules"| node_tour_calc
node_minimizer -->|"evaluates candidate tours"| node_tour_calc
node_logic_thread -->|"checks release decision"| node_pivot
node_runtime -->|"prints picking batch"| node_batch_output
node_tour_calc -->|"provides tour ordering"| node_batch_output

click node_main "https://github.com/philippxxy/on-line-order-batching/blob/main/src/main.py"
click node_initialize "https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_initialize.py"
click node_cli_thread "https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli_controller.py"
click node_runtime "https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_runtime.py"
click node_orders_source "https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/imported_orders.py"
click node_logic_thread "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic_controller.py"
click node_shared "https://github.com/philippxxy/on-line-order-batching/blob/main/src/vars/shared_variables.py"
click node_input_handler "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/input_handler.py"
click node_order_join "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/join_item_information.py"
click node_selector "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/batch_selector.py"
click node_minimizer "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/batch_tour_length_minimizer.py"
click node_pivot "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/pivot_logic.py"
click node_tour_calc "https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/batch_tour_length_calculator.py"
click node_batch_output "https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_runtime.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_initialize,node_cli_thread,node_runtime,node_orders_source,node_batch_output toneBlue
class node_main,node_logic_thread,node_shared,node_input_handler,node_warehouse_file,node_order_join toneAmber
class node_selector,node_minimizer,node_pivot toneMint
class node_tour_calc toneRose
class node_operator toneIndigo
```

## Components

### CLI interaction

- [Configure run](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_initialize.py): `src/ui/cli/cli_initialize.py`
- [CLI thread](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli_controller.py): `src/ui/cli_controller.py`
- [Interactive runtime](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_runtime.py): `src/ui/cli/cli_runtime.py`
- [Imported orders](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/imported_orders.py): `src/ui/imported_orders.py`
- [Batch and tour display](https://github.com/philippxxy/on-line-order-batching/blob/main/src/ui/cli/cli_runtime.py): `src/ui/cli/cli_runtime.py`

### Runtime coordination

- [Program entry](https://github.com/philippxxy/on-line-order-batching/blob/main/src/main.py): `src/main.py`
- [Logic thread](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic_controller.py): `src/core/logic_controller.py`
- [Shared runtime state](https://github.com/philippxxy/on-line-order-batching/blob/main/src/vars/shared_variables.py): `src/vars/shared_variables.py`
- [Order and layout access](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/input_handler.py): `src/core/logic/input_handler.py`
- **Warehouse layout CSV**
- [Join item positions](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/join_item_information.py): `src/core/logic/join_item_information.py`

### Batch optimization

- [Batch construction and selection](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/batch_selector.py): `src/core/logic/batch_selector.py`
- [Iterated local search](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/batch_tour_length_minimizer.py): `src/core/logic/batch_tour_length_minimizer.py`
- [Online release decisions](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/pivot_logic.py): `src/core/logic/pivot_logic.py`

### Warehouse routing

- [S-shape tour calculation](https://github.com/philippxxy/on-line-order-batching/blob/main/src/core/logic/batch_tour_length_calculator.py): `src/core/logic/batch_tour_length_calculator.py`

### Other components

- **Warehouse operator**

## Connections

- Warehouse operator → Configure run: provides settings
- Configure run → Program entry: returns configuration
- Program entry → CLI thread: starts thread
- Program entry → Logic thread: starts thread
- CLI thread → Interactive runtime: runs
- Imported orders → CLI thread: supplies orders
- CLI thread → Shared runtime state: queues released orders
- Interactive runtime → Shared runtime state: reads batch and picker state
- Logic thread → Shared runtime state: updates runtime state
- Logic thread → Order and layout access: reads orders and settings
- Warehouse layout CSV → Order and layout access: loads layout
- Order and layout access → Join item positions: joins item positions
- Logic thread → Batch construction and selection: optimizes arrived orders
- Batch construction and selection → Iterated local search: improves batches
- Batch construction and selection → S-shape tour calculation: evaluates selection rules
- Iterated local search → S-shape tour calculation: evaluates candidate tours
- Logic thread → Online release decisions: checks release decision
- Interactive runtime → Batch and tour display: prints picking batch
- S-shape tour calculation → Batch and tour display: provides tour ordering
