Skip to content

Commit a963981

Browse files
committed
fix examples
1 parent 3708f45 commit a963981

7 files changed

Lines changed: 336 additions & 245 deletions

File tree

examples/README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ This directory provides a complete demonstration suite for **allocator v1.0** us
66

77
```bash
88
# 1. Basic API introduction (1-2 seconds)
9-
cd scripts && uv run python quick_start.py
9+
uv run python examples/scripts/quick_start.py
1010

1111
# 2. Real-world performance analysis (5-10 seconds)
12-
uv run python real_world_workflow.py
12+
uv run python examples/scripts/real_world_workflow.py
1313

1414
# 3. Generate comprehensive visualizations (30-60 seconds)
15-
uv run python algorithm_comparison.py
15+
uv run python examples/scripts/algorithm_comparison.py
1616

1717
# View results
18-
open ../outputs/latest/comparisons/reports/executive_summary.html
18+
open examples/outputs/latest/comparisons/reports/executive_summary.html
1919
```
2020

2121
## 📁 Directory Structure
@@ -74,23 +74,23 @@ examples/
7474

7575
### 1. Quick API Introduction
7676
```bash
77-
cd scripts && uv run python quick_start.py
77+
uv run python examples/scripts/quick_start.py
7878
```
7979
- **Purpose:** Learn basic allocator functionality
8080
- **Runtime:** 1-2 seconds
8181
- **Output:** Console demonstration of clustering, routing, assignment
8282

8383
### 2. Real-World Performance Analysis
8484
```bash
85-
cd scripts && uv run python real_world_workflow.py
85+
uv run python examples/scripts/real_world_workflow.py
8686
```
8787
- **Purpose:** Production performance validation
8888
- **Runtime:** 5-10 seconds
8989
- **Output:** Performance metrics using actual city data
9090

9191
### 3. Comprehensive Visualization Generation
9292
```bash
93-
cd scripts && uv run python algorithm_comparison.py
93+
uv run python examples/scripts/algorithm_comparison.py
9494
```
9595
- **Purpose:** Research, reporting, executive presentations
9696
- **Runtime:** 30-60 seconds
@@ -102,6 +102,9 @@ cd scripts && uv run python algorithm_comparison.py
102102
- 📄 **HTML reports:** Executive summaries, detailed analysis
103103
- 🔧 **JSON summaries:** Machine-readable performance metrics
104104

105+
**💾 Intermediate File Preservation:**
106+
All generated outputs (PNG charts, CSV data, HTML reports) are automatically preserved in timestamped directories under `examples/outputs/YYYY-MM-DD_HH-MM/` with organized structure by city and analysis type. This ensures all intermediate analysis files are retained for review, comparison, and further processing.
107+
105108
## 📊 Example Outputs
106109

107110
### Performance Metrics (typical results)
@@ -177,19 +180,19 @@ All dependencies are defined in `../../pyproject.toml`:
177180
### Development & Testing
178181
```bash
179182
# Quick validation (1-2 seconds)
180-
uv run python quick_start.py
183+
uv run python examples/scripts/quick_start.py
181184

182185
# Performance testing (5-10 seconds)
183-
uv run python real_world_workflow.py
186+
uv run python examples/scripts/real_world_workflow.py
184187
```
185188

186189
### Production Analysis
187190
```bash
188191
# Comprehensive reporting (30-60 seconds)
189-
uv run python algorithm_comparison.py
192+
uv run python examples/scripts/algorithm_comparison.py
190193

191194
# Custom CLI workflows
192-
uv run allocator cluster kmeans inputs/delhi-roads-1k.csv --n-clusters 7 --output results.csv
195+
uv run allocator cluster kmeans examples/inputs/delhi-roads-1k.csv --n-clusters 7 --output results.csv
193196
```
194197

195198
### Large-Scale Deployment
@@ -222,7 +225,7 @@ route = allocator.shortest_path(points.head(10), method='ortools')
222225
#!/bin/bash
223226
# Production batch processing
224227
for city in delhi chonburi; do
225-
allocator cluster kmeans inputs/${city}-roads-1k.csv \
228+
allocator cluster kmeans examples/inputs/${city}-roads-1k.csv \
226229
--n-clusters 5 \
227230
--output results/${city}_zones.csv
228231
done
@@ -232,7 +235,7 @@ done
232235
```python
233236
# Load analysis results for dashboard
234237
import json
235-
with open('outputs/latest/comparisons/data/analysis_summary.json') as f:
238+
with open('examples/outputs/latest/comparisons/data/analysis_summary.json') as f:
236239
metrics = json.load(f)
237240

238241
# Display in web dashboard, monitoring system, etc.
@@ -250,9 +253,9 @@ This demonstration suite validates:
250253

251254
## 📝 Next Steps
252255

253-
1. **Explore:** Run `quick_start.py` to understand basic functionality
254-
2. **Validate:** Use `real_world_workflow.py` for performance insights
255-
3. **Generate:** Create professional reports with `algorithm_comparison.py`
256+
1. **Explore:** Run `uv run python examples/scripts/quick_start.py` to understand basic functionality
257+
2. **Validate:** Use `uv run python examples/scripts/real_world_workflow.py` for performance insights
258+
3. **Generate:** Create professional reports with `uv run python examples/scripts/algorithm_comparison.py`
256259
4. **Customize:** Modify scripts for your specific datasets and requirements
257260
5. **Scale:** Implement in production systems using CLI or Python API
258261

examples/README_WORKFLOWS.md

Lines changed: 0 additions & 210 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Allocator Analysis Run - 2025-12-01 12:57
2+
3+
## 📁 Directory Structure
4+
5+
```
6+
2025-12-01_12-57/
7+
├── delhi/
8+
│ ├── clustering/
9+
│ │ ├── data/ # CSV files with clustering results
10+
│ │ ├── visualizations/ # PNG performance charts
11+
│ │ └── reports/ # HTML detailed analysis
12+
│ ├── routing/
13+
│ │ ├── data/ # TSP solution CSV files
14+
│ │ ├── visualizations/ # Route performance charts
15+
│ │ └── reports/ # HTML routing analysis
16+
│ └── assignments/ # (Future: assignment analysis)
17+
├── chonburi/
18+
│ └── [same structure as delhi]
19+
└── comparisons/
20+
├── data/ # Cross-city comparison data
21+
├── visualizations/ # Comparison charts
22+
└── reports/ # Executive summary report
23+
```
24+
25+
## 🎯 Key Files
26+
27+
- **Executive Summary:** `comparisons/reports/executive_summary.html`
28+
- **City Reports:** `[city]/[analysis]/reports/[city]_[analysis]_report.html`
29+
- **Performance Data:** `comparisons/data/analysis_summary.json`
30+
- **Visualizations:** `[city]/[analysis]/visualizations/*.png`
31+
32+
## 📊 Analysis Overview
33+
34+
This run analyzed road network data for Delhi, India and Chonburi, Thailand using:
35+
36+
- **Clustering:** K-means with euclidean and haversine distance methods
37+
- **Routing:** TSP optimization using OR-Tools
38+
- **Distance Methods:** Comparative analysis of calculation methods
39+
40+
## 🚀 Next Steps
41+
42+
1. View executive summary for high-level insights
43+
2. Review city-specific reports for detailed analysis
44+
3. Use CSV data files for further processing
45+
4. Scale analysis to larger datasets or additional cities
46+
47+
## 🔗 Links
48+
49+
- [Executive Summary](comparisons/reports/executive_summary.html)
50+
- [Delhi Analysis](delhi/)
51+
- [Chonburi Analysis](chonburi/)
52+
- [Source Code](../scripts/)

0 commit comments

Comments
 (0)