You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Server-Sent Events (SSE) endpoint for loading demo data with progress updates. Use this when `routing=real_roads` to show download/computation progress.
800
+
801
+
**Parameters:**
802
+
-`demo_name`: Name of the demo dataset
803
+
-`routing` (query, optional): `haversine` (default) or `real_roads`
804
+
805
+
**Request:**
806
+
```
807
+
GET /demo-data/PHILADELPHIA/stream?routing=real_roads
This quickstart supports two routing modes, selectable via the UI toggle or API parameter:
1597
1655
1598
-
SolverForge includes a **built-in distance mode selector** — no custom code required. Choose between:
1656
+
#### Haversine Mode (Default)
1599
1657
1600
-
This quickstart uses the Haversine formula for distance calculations, which provides realistic great-circle distances without external dependencies.
1658
+
Fast great-circle distance calculation using the Haversine formula:
1659
+
- No external dependencies or network calls
1660
+
- Assumes 50 km/h average driving speed
1661
+
- Routes display as straight lines on the map
1662
+
- Best for: development, testing, and quick iterations
1663
+
1664
+
#### Real Roads Mode
1665
+
1666
+
Actual road network routing using OpenStreetMap data via OSMnx:
1667
+
- Downloads and caches road network data locally
1668
+
- Computes shortest paths using Dijkstra's algorithm
1669
+
- Routes display as actual road paths on the map
1670
+
- Progress streaming via Server-Sent Events (SSE)
1671
+
1672
+
**First-time use:** The initial load downloads ~5-15 MB of road network data for the demo area (cached for subsequent runs).
1673
+
1674
+
**How it works:**
1675
+
1. Enable "Real Roads" toggle in the UI before loading demo data
1676
+
2. The system downloads/loads the OSM road network for the bounding box
1677
+
3. A distance matrix is precomputed for all location pairs
1678
+
4. The solver uses real driving times; the UI displays actual road routes
1679
+
1680
+
```python
1681
+
# The Location class automatically uses the distance matrix when set
1682
+
Location.set_distance_matrix(matrix)
1683
+
1684
+
# Solver calls driving_time_to() which checks for matrix first
1685
+
time = loc1.driving_time_to(loc2) # Uses matrix if available, else haversine
1686
+
```
1601
1687
1602
-
### Real Road Network Data
1688
+
### Custom Routing APIs
1603
1689
1604
-
For production deployments requiring actual road distances (not straight-line approximations), you can replace the distance calculation in `Location.driving_time_to()` with a pre-computed matrix from a routing API:
1690
+
For production with proprietary routing (Google Maps, Mapbox, OSRM), pre-compute a distance matrix before solving:
1605
1691
1606
1692
```python
1607
1693
defbuild_real_distance_matrix(locations):
@@ -1819,7 +1905,8 @@ if solution.score and solution.score.hard_score < 0:
1819
1905
| Add field to Vehicle |`src/vehicle_routing/domain.py` + `converters.py`|
1820
1906
| Add field to Visit |`src/vehicle_routing/domain.py` + `converters.py`|
1821
1907
| Change solve time |`src/vehicle_routing/solver.py`|
0 commit comments