File size: 20,756 Bytes
aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc fa2c20f aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c aedf8cc 167999c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
# ๐๏ธ Supply Roster Optimization Tool - Architecture Diagram
## ๐ System Overview
This document provides a comprehensive architectural overview of the Supply Roster Optimization Tool, including all system components, data flows, and interconnections.
---
## ๐ฏ High-Level Architecture
```mermaid
graph TB
subgraph "๐ Entry Points"
MAIN[main.py<br/>Main Entry Point]
APP[ui/app.py<br/>Streamlit App]
end
subgraph "๐จ UI Layer - Streamlit Pages"
CONFIG[config_page.py<br/>Settings & Configuration]
RESULTS[optimization_results.py<br/>Results Visualization]
VALIDATION[demand_validation_viz.py<br/>Data Validation]
end
subgraph "๐งฎ Core Logic"
OPTIMIZER[optimizer_real.py<br/>OR-Tools Optimization<br/>CBC Solver]
FILTER[demand_filtering.py<br/>Demand Filtering Logic]
end
subgraph "โ๏ธ Configuration"
OPT_CONFIG[optimization_config.py<br/>Dynamic Configuration<br/>Parameters & Settings]
CONSTANTS[constants.py<br/>Enums & Constants<br/>ShiftType, LineType, KitLevel]
PATHS[paths.yaml<br/>File Path Configuration]
end
subgraph "๐ Data Preprocessing"
CONVERTER[excel_to_csv_converter.py<br/>Excel โ CSV]
EXTRACT[extract.py<br/>Data Reading Functions]
TRANSFORM[transform.py<br/>Data Transformation]
HIERARCHY[hierarchy_parser.py<br/>Kit Hierarchy Parser]
CLEANER[kit_composition_cleaner.py<br/>Data Cleaning]
PREPROCESS[data_preprocess.py<br/>Main Preprocessing]
end
subgraph "๐ Data Sources"
EXCEL[(Excel Files<br/>AI Project document.xlsx)]
CSV[(CSV Files<br/>30+ Data Files)]
HIERARCHY_JSON[(kit_hierarchy.json<br/>Kit Dependencies)]
end
subgraph "๐ Visualization"
PLOTLY[Plotly Charts<br/>Interactive Visualizations]
HIERARCHY_DASH[hierarchy_dashboard.py<br/>Hierarchy Visualization]
KIT_REL[kit_relationships.py<br/>Kit Relationships]
end
%% Entry Points Flow
MAIN --> APP
APP --> CONFIG
APP --> RESULTS
APP --> VALIDATION
%% UI to Core Logic
CONFIG -->|User Settings| OPT_CONFIG
CONFIG -->|Run Optimization| OPTIMIZER
RESULTS -->|Display Results| PLOTLY
VALIDATION -->|Validate Data| FILTER
%% Configuration Flow
OPT_CONFIG --> CONSTANTS
OPT_CONFIG --> PATHS
OPT_CONFIG --> EXTRACT
OPTIMIZER --> OPT_CONFIG
%% Preprocessing Flow
EXCEL -->|Convert| CONVERTER
CONVERTER --> CSV
CSV --> EXTRACT
EXTRACT --> TRANSFORM
EXTRACT --> HIERARCHY
TRANSFORM --> PREPROCESS
HIERARCHY -->|Parse| HIERARCHY_JSON
HIERARCHY_JSON --> OPT_CONFIG
CLEANER --> CSV
%% Data to Optimization
CSV --> EXTRACT
EXTRACT -->|Read Data| OPT_CONFIG
HIERARCHY_JSON -->|Dependencies| OPT_CONFIG
OPT_CONFIG -->|Parameters| OPTIMIZER
%% Optimization to Results
OPTIMIZER -->|Results| RESULTS
FILTER -->|Filtered Data| VALIDATION
%% Visualization
RESULTS --> PLOTLY
RESULTS --> HIERARCHY_DASH
RESULTS --> KIT_REL
%% Styling
classDef entryPoint fill:#4CAF50,stroke:#2E7D32,color:#fff
classDef ui fill:#2196F3,stroke:#1565C0,color:#fff
classDef core fill:#FF9800,stroke:#E65100,color:#fff
classDef config fill:#9C27B0,stroke:#6A1B9A,color:#fff
classDef preprocess fill:#00BCD4,stroke:#006064,color:#fff
classDef data fill:#607D8B,stroke:#37474F,color:#fff
classDef viz fill:#E91E63,stroke:#880E4F,color:#fff
class MAIN,APP entryPoint
class CONFIG,RESULTS,VALIDATION ui
class OPTIMIZER,FILTER core
class OPT_CONFIG,CONSTANTS,PATHS config
class CONVERTER,EXTRACT,TRANSFORM,HIERARCHY,CLEANER,PREPROCESS preprocess
class EXCEL,CSV,HIERARCHY_JSON data
class PLOTLY,HIERARCHY_DASH,KIT_REL viz
```
---
## ๐ Data Flow Details
```mermaid
flowchart LR
subgraph "1๏ธโฃ Data Ingestion"
A1[Excel Files] -->|excel_to_csv_converter.py| A2[CSV Files]
A2 -->|hierarchy_parser.py| A3[kit_hierarchy.json]
end
subgraph "2๏ธโฃ Data Processing"
B1[extract.py<br/>Read Functions]
B2[transform.py<br/>Transform Logic]
B3[data_preprocess.py<br/>Main Processing]
A2 --> B1
B1 --> B2
B2 --> B3
A3 --> B1
end
subgraph "3๏ธโฃ Configuration"
C1[optimization_config.py]
C2[Dynamic Parameters:<br/>- Products<br/>- Demand<br/>- Employees<br/>- Costs<br/>- Hierarchy]
B3 --> C1
C1 --> C2
end
subgraph "4๏ธโฃ Optimization"
D1[optimizer_real.py]
D2[OR-Tools CBC Solver]
D3[Variables:<br/>- Assignment<br/>- Hours<br/>- Units<br/>- Employee Count]
D4[Constraints:<br/>- Demand<br/>- Capacity<br/>- Dependencies<br/>- Staffing]
C2 --> D1
D1 --> D2
D2 --> D3
D3 --> D4
end
subgraph "5๏ธโฃ Results"
E1[Optimization Results:<br/>- Schedule<br/>- Production<br/>- Costs<br/>- Headcount]
E2[Visualization:<br/>- Charts<br/>- Tables<br/>- Analysis]
D4 --> E1
E1 --> E2
end
style A1 fill:#607D8B,color:#fff
style A2 fill:#607D8B,color:#fff
style A3 fill:#607D8B,color:#fff
style B1 fill:#00BCD4,color:#fff
style B2 fill:#00BCD4,color:#fff
style B3 fill:#00BCD4,color:#fff
style C1 fill:#9C27B0,color:#fff
style C2 fill:#9C27B0,color:#fff
style D1 fill:#FF9800,color:#fff
style D2 fill:#FF9800,color:#fff
style D3 fill:#FF9800,color:#fff
style D4 fill:#FF9800,color:#fff
style E1 fill:#2196F3,color:#fff
style E2 fill:#E91E63,color:#fff
```
---
## ๐ฆ Key Data Files & Their Purpose
```mermaid
mindmap
root((Data Sources))
Raw Excel
AI Project document.xlsx
30+ sheets of data
Production orders
Workforce info
Kit compositions
CSV Files
Demand Data
COOIS_Planned_and_Released.csv
Active_Kit_overview.csv
Order_management_Gui.csv
Workforce Data
WH_Workforce_Hourly_Pay_Scale.csv
workforce_info.csv
Fixed_Workstation_manning.csv
Production Data
Kits__Calculation.csv
Kit_Composition_and_relation.csv
Material_Master_WMS.csv
Capacity Data
Work_Centre_Capacity.csv
work_shift_timing.csv
Bagging_Workcenters.csv
Long_line_Workcenters.csv
Short_line_Workcenters.csv
Hierarchy Data
kit_hierarchy.json
Master โ Subkit โ Prepack
Dependencies
Production order
```
---
## ๐งฎ Optimization Model Components
```mermaid
graph TD
subgraph "๐ฅ Input Parameters"
I1[Products & Demand<br/>What to produce & how much]
I2[Workforce<br/>Available employees by type]
I3[Production Lines<br/>Long lines, Short lines]
I4[Costs<br/>Hourly rates by shift]
I5[Kit Hierarchy<br/>Dependencies & levels]
end
subgraph "๐ฏ Optimization Variables"
V1[Assignment Variables<br/>Product โ Line ร Shift ร Day]
V2[Hours Variables<br/>Production time per assignment]
V3[Units Variables<br/>Production quantity]
V4[Employee Count Variables<br/>Workers needed per shift]
end
subgraph "โ๏ธ Constraints"
C1[Demand Constraints<br/>Must meet exact demand]
C2[Capacity Constraints<br/>Line & worker limits]
C3[Hierarchy Constraints<br/>Dependencies first]
C4[Staffing Constraints<br/>Min UNICEF employees]
C5[Shift Ordering<br/>Overtime rules]
C6[Line Compatibility<br/>Product-line matching]
end
subgraph "๐ฏ Objective Function"
O1[Minimize Total Labor Cost<br/>Cost = ฮฃ employees ร hours ร hourly_rate]
end
subgraph "โ
Output Results"
R1[Production Schedule<br/>Day ร Line ร Shift ร Product]
R2[Employee Allocation<br/>Type ร Shift ร Day ร Count]
R3[Cost Breakdown<br/>Total cost & per employee type]
R4[Production Metrics<br/>Units produced & fulfillment %]
end
I1 --> V1
I2 --> V4
I3 --> V1
I4 --> O1
I5 --> C3
V1 --> C1
V1 --> C2
V1 --> C6
V2 --> C2
V2 --> C5
V3 --> C1
V4 --> C4
C1 --> O1
C2 --> O1
C3 --> O1
C4 --> O1
C5 --> O1
C6 --> O1
O1 --> R1
O1 --> R2
O1 --> R3
O1 --> R4
classDef input fill:#4CAF50,stroke:#2E7D32,color:#fff
classDef variable fill:#2196F3,stroke:#1565C0,color:#fff
classDef constraint fill:#FF9800,stroke:#E65100,color:#fff
classDef objective fill:#9C27B0,stroke:#6A1B9A,color:#fff
classDef output fill:#E91E63,stroke:#880E4F,color:#fff
class I1,I2,I3,I4,I5 input
class V1,V2,V3,V4 variable
class C1,C2,C3,C4,C5,C6 constraint
class O1 objective
class R1,R2,R3,R4 output
```
---
## ๐จ UI Components & User Flow
```mermaid
journey
title User Journey Through the Application
section 1. Launch
Run main.py: 5: User
Streamlit starts: 5: System
App loads: 5: System
section 2. Configuration
Navigate to Settings: 5: User
Select date range: 5: User
Configure workforce: 4: User
Set cost rates: 4: User
Choose shifts: 4: User
section 3. Optimization
Click Optimize: 5: User
Load data: 5: System
Run OR-Tools: 3: System
Generate solution: 3: System
section 4. Results
View weekly summary: 5: User
Explore daily breakdown: 4: User
Check line schedules: 4: User
Analyze costs: 4: User
section 5. Validation
Review demand data: 4: User
Check input data: 4: User
Validate results: 5: User
```
---
## ๐ Module Dependency Graph
```mermaid
graph LR
subgraph "UI Modules"
UI1[app.py]
UI2[config_page.py]
UI3[optimization_results.py]
UI4[demand_validation_viz.py]
end
subgraph "Model Modules"
M1[optimizer_real.py]
M2[demand_filtering.py]
end
subgraph "Config Modules"
C1[optimization_config.py]
C2[constants.py]
C3[paths.yaml]
end
subgraph "Preprocess Modules"
P1[extract.py]
P2[transform.py]
P3[hierarchy_parser.py]
P4[data_preprocess.py]
P5[excel_to_csv_converter.py]
end
subgraph "Visualization Modules"
V1[hierarchy_dashboard.py]
V2[kit_relationships.py]
end
UI1 --> UI2
UI1 --> UI3
UI1 --> UI4
UI2 --> C1
UI2 --> M1
UI3 --> C1
UI3 --> V1
UI3 --> V2
UI4 --> M2
M1 --> C1
M1 --> C2
M1 --> P1
M2 --> P1
C1 --> C2
C1 --> C3
C1 --> P1
C1 --> P3
P1 --> C3
P2 --> P1
P3 --> P1
P4 --> P1
P4 --> P2
V1 --> P3
V2 --> P3
classDef ui fill:#2196F3,stroke:#1565C0,color:#fff
classDef model fill:#FF9800,stroke:#E65100,color:#fff
classDef config fill:#9C27B0,stroke:#6A1B9A,color:#fff
classDef preprocess fill:#00BCD4,stroke:#006064,color:#fff
classDef viz fill:#E91E63,stroke:#880E4F,color:#fff
class UI1,UI2,UI3,UI4 ui
class M1,M2 model
class C1,C2,C3 config
class P1,P2,P3,P4,P5 preprocess
class V1,V2 viz
```
---
## ๐ Kit Hierarchy System
```mermaid
graph TD
subgraph "Kit Hierarchy Levels"
L0[Level 0: Prepack<br/>Base components<br/>No dependencies]
L1[Level 1: Subkit<br/>Intermediate assembly<br/>Depends on prepacks]
L2[Level 2: Master<br/>Final products<br/>Depends on subkits]
end
subgraph "Production Order"
P1[1st: Produce Prepacks]
P2[2nd: Assemble Subkits]
P3[3rd: Complete Masters]
end
subgraph "Dependency Rules"
D1[Dependencies must be<br/>produced before or<br/>at the same time]
D2[Topological sorting<br/>ensures correct order]
D3[Constraint in optimizer:<br/>dep_completion โค product_completion]
end
L0 --> P1
L1 --> P2
L2 --> P3
P1 --> P2
P2 --> P3
P1 --> D1
P2 --> D1
P3 --> D1
D1 --> D2
D2 --> D3
classDef level fill:#4CAF50,stroke:#2E7D32,color:#fff
classDef order fill:#2196F3,stroke:#1565C0,color:#fff
classDef rule fill:#FF9800,stroke:#E65100,color:#fff
class L0,L1,L2 level
class P1,P2,P3 order
class D1,D2,D3 rule
```
---
## ๐ Execution Flow
```mermaid
sequenceDiagram
actor User
participant Main as main.py
participant App as Streamlit App
participant Config as Config Page
participant OptConfig as optimization_config.py
participant Extract as extract.py
participant Optimizer as optimizer_real.py
participant Results as Results Page
User->>Main: python main.py
Main->>App: Launch Streamlit
App->>Config: Show Settings Page
User->>Config: Configure parameters
Config->>OptConfig: Update settings
User->>Config: Click Optimize
Config->>Extract: Load CSV data
Extract-->>Config: Return data
Config->>OptConfig: Get all parameters
OptConfig-->>Config: Return config
Config->>Optimizer: Optimizer().run_optimization()
Optimizer->>OptConfig: Get products
Optimizer->>OptConfig: Get demand
Optimizer->>OptConfig: Get employees
Optimizer->>OptConfig: Get costs
Optimizer->>OptConfig: Get hierarchy
Optimizer->>Optimizer: Build OR-Tools model
Optimizer->>Optimizer: Add constraints
Optimizer->>Optimizer: Set objective
Optimizer->>Optimizer: Solve with CBC
Optimizer-->>Config: Return results
Config->>App: Store in session_state
User->>App: Navigate to Results
App->>Results: Display results
Results->>Results: Generate charts
Results-->>User: Show visualizations
```
---
## ๐ Key Technologies & Libraries
```mermaid
mindmap
root((Tech Stack))
Python 3.10
Core Language
Streamlit
Web UI Framework
Interactive Dashboard
Session State Management
OR-Tools
Optimization Engine
CBC Solver
Linear Programming
Data Processing
Pandas
CSV/Excel handling
Data transformation
NumPy
Numerical operations
Visualization
Plotly
Interactive charts
Bar charts
Pie charts
Timeline charts
File Formats
CSV
Data storage
JSON
Hierarchy storage
YAML
Configuration
```
---
## ๐ Configuration Files
### paths.yaml
Centralized file path management:
- CSV file paths
- Excel file paths
- Hierarchy JSON paths
### optimization_config.py
Dynamic optimization parameter management:
- Product list (`get_product_list()`)
- Demand data (`get_demand_dictionary()`)
- Employee types (`get_employee_type_list()`)
- Cost information (`get_cost_list_per_emp_shift()`)
- Kit hierarchy (`KIT_LEVELS`, `KIT_DEPENDENCIES`)
- Line configuration (`get_line_list()`, `get_line_cnt_per_type()`)
- Shift configuration (`get_active_shift_list()`)
### constants.py
Constants and Enum definitions:
- `ShiftType`: Regular(1), Evening(2), Overtime(3)
- `LineType`: Long Line(6), Short Line(7)
- `KitLevel`: Prepack(0), Subkit(1), Master(2)
---
## ๐ก Key Features
### 1. Dynamic Configuration
- All parameters can be dynamically configured from the UI
- State management with session state
- Real-time data loading
### 2. Hierarchy-Based Optimization
- 3-level hierarchy structure (Prepack โ Subkit โ Master)
- Automatic dependency constraint application
- Production order determined by topological sorting
### 3. Multi-Shift Scheduling
- Support for Regular, Evening, and Overtime shifts
- Different cost rates per shift
- Bulk/Partial payment mode selection
### 4. Comprehensive Visualization
- Weekly production summary
- Daily employee allocation
- Line-by-line schedules
- Cost analysis
- Hierarchy structure visualization
### 5. Data Validation
- Demand data verification
- Input data validation
- Feasibility checks
---
## ๐ฏ Optimization Objective
**Goal**: Minimize Total Labor Cost
```
Minimize: ฮฃ (employee_type, shift, day) [
hourly_rate ร hours_worked ร employees_count
]
```
**Subject to Constraints**:
1. **Demand Fulfillment**: Must produce exactly the weekly demand for each product
2. **Capacity Limits**: Line and shift hour limitations
3. **Hierarchy Constraints**: Dependencies must be produced first
4. **Staffing Constraints**: Daily employee availability limits by type
5. **Line Compatibility**: Product-line type matching
6. **Shift Ordering**: Overtime only when Regular is at 90%+ capacity
7. **Minimum Staffing**: Guaranteed minimum UNICEF employees
---
## ๐ Performance Considerations
### OR-Tools CBC Solver
- **Pros**: Free open-source, commercial-use allowed, reasonable performance
- **Cons**: Can be slow on large-scale problems
- **Optimizations**:
- Minimize variable count
- Efficient constraint formulation
- Pre-filtering to eliminate unnecessary combinations
### Data Loading
- **CSV Caching**: Use Streamlit `@st.cache_data`
- **Session State**: Store optimization results
- **Lazy Loading**: Load only required data
---
## ๐ง Future Enhancement Opportunities
1. **Database Integration**: CSV โ PostgreSQL/MySQL
2. **Advanced Solver**: CBC โ Gurobi/CPLEX for faster solving
3. **Real-time Updates**: WebSocket for live optimization status
4. **Machine Learning**: Demand forecasting, production time prediction
5. **Multi-objective**: Consider completion time, resource utilization beyond cost
6. **Parallel Processing**: Run multiple scenarios simultaneously
7. **Export Features**: PDF reports, Excel result exports
---
## ๐ Documentation Structure
```
SD_roster_real/
โโโ README.md # Project overview and quick start
โโโ ARCHITECTURE_DIAGRAM.md # This file - architecture diagrams
โโโ requirements.txt # Python dependencies
โโโ setup.py # Package setup
โ
โโโ main.py # Main entry point
โ
โโโ ui/ # Streamlit UI
โ โโโ app.py # Main app
โ โโโ pages/ # Page components
โ
โโโ src/ # Core business logic
โ โโโ config/ # Configuration management
โ โโโ models/ # Optimization models
โ โโโ preprocess/ # Data preprocessing
โ โโโ visualization/ # Chart generation
โ
โโโ data/ # Data files
โ โโโ real_data_excel/ # Original Excel files
โ โ โโโ converted_csv/ # Converted CSV files
โ โโโ hierarchy_exports/ # Hierarchy JSON structures
โ
โโโ notebook/ # Jupyter notebooks (for analysis)
```
---
## ๐ Learning Path
Recommended order for understanding this project:
1. **Start**: `README.md` - Project overview
2. **Run**: `main.py` โ `ui/app.py` - Run the application
3. **UI**: `ui/pages/config_page.py` - Understand UI structure
4. **Config**: `src/config/optimization_config.py` - Configuration system
5. **Data**: `src/preprocess/extract.py` - Data loading
6. **Core**: `src/models/optimizer_real.py` - Optimization logic
7. **Results**: `ui/pages/optimization_results.py` - Results visualization
8. **Architecture**: This file - Big picture understanding
---
## ๐ Component Interaction Summary
| Layer | Components | Purpose | Key Technologies |
|-------|-----------|---------|-----------------|
| **Entry** | main.py, app.py | Application launch | Python, Streamlit |
| **UI** | config_page, optimization_results, demand_validation_viz | User interface | Streamlit, Plotly |
| **Core** | optimizer_real, demand_filtering | Business logic | OR-Tools, NumPy |
| **Config** | optimization_config, constants, paths | Configuration | Python, YAML |
| **Preprocess** | extract, transform, hierarchy_parser | Data preparation | Pandas, JSON |
| **Data** | CSV files, JSON files | Data storage | CSV, JSON |
| **Viz** | Plotly charts, hierarchy_dashboard | Visualization | Plotly, Matplotlib |
---
## โ
Conclusion
The Supply Roster Optimization Tool features:
- **Modular Architecture**: Clear separation of layers
- **Dynamic Configuration**: All parameters adjustable from UI
- **Powerful Optimization**: Complex constraints handled by OR-Tools
- **Intuitive Visualization**: Clear result presentation with Plotly
- **Extensible Design**: Easy to add new features
The entire system operates as a pipeline: **Data Collection โ Preprocessing โ Configuration โ Optimization โ Result Display**
|