fix: Mount route_optimization router in main.py for VRP/TSP endpoints
#31
by MouleeswaranM - opened
- brain/app/main.py +10 -0
brain/app/main.py
CHANGED
|
@@ -27,6 +27,7 @@ from app.api import (
|
|
| 27 |
)
|
| 28 |
from app.api.agent_events import router as agent_events_router
|
| 29 |
from app.api.runs import router as runs_router
|
|
|
|
| 30 |
|
| 31 |
# Configure structured logging
|
| 32 |
logging.basicConfig(
|
|
@@ -82,6 +83,11 @@ app = FastAPI(
|
|
| 82 |
5. **Final Resolution** β Resolves counter-proposals via swaps
|
| 83 |
6. **Explainability** β Human-readable allocation explanations
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
### LoRRI Integration
|
| 86 |
- `POST /lorri/allocate` β Production endpoint with API key auth
|
| 87 |
- `POST /lorri/wellness` β Driver wellness scoring
|
|
@@ -119,6 +125,9 @@ app.add_middleware(
|
|
| 119 |
app.include_router(allocation_router, prefix=settings.api_prefix)
|
| 120 |
app.include_router(allocation_langgraph_router, prefix=settings.api_prefix)
|
| 121 |
|
|
|
|
|
|
|
|
|
|
| 122 |
# Resources
|
| 123 |
app.include_router(drivers_router, prefix=settings.api_prefix)
|
| 124 |
app.include_router(routes_router, prefix=settings.api_prefix)
|
|
@@ -183,6 +192,7 @@ async def api_health():
|
|
| 183 |
"database": "connected" if db_ok else "sqlite_fallback",
|
| 184 |
"version": settings.app_version,
|
| 185 |
"agents": ["ml_effort", "route_planner", "fairness_manager", "driver_liaison", "final_resolution", "explainability"],
|
|
|
|
| 186 |
"langgraph": True,
|
| 187 |
"lorri_integration": True,
|
| 188 |
}
|
|
|
|
| 27 |
)
|
| 28 |
from app.api.agent_events import router as agent_events_router
|
| 29 |
from app.api.runs import router as runs_router
|
| 30 |
+
from app.api.route_optimization import router as route_optimization_router
|
| 31 |
|
| 32 |
# Configure structured logging
|
| 33 |
logging.basicConfig(
|
|
|
|
| 83 |
5. **Final Resolution** β Resolves counter-proposals via swaps
|
| 84 |
6. **Explainability** β Human-readable allocation explanations
|
| 85 |
|
| 86 |
+
### Route Optimization (VRP/TSP)
|
| 87 |
+
- `POST /api/v1/routes/optimize` β Multi-stop TSP with 2-opt (before/after comparison)
|
| 88 |
+
- `POST /api/v1/routes/cluster` β DBSCAN or KMeans clustering
|
| 89 |
+
- `POST /api/v1/routes/dynamic-insert` β Cheapest-insertion re-routing
|
| 90 |
+
|
| 91 |
### LoRRI Integration
|
| 92 |
- `POST /lorri/allocate` β Production endpoint with API key auth
|
| 93 |
- `POST /lorri/wellness` β Driver wellness scoring
|
|
|
|
| 125 |
app.include_router(allocation_router, prefix=settings.api_prefix)
|
| 126 |
app.include_router(allocation_langgraph_router, prefix=settings.api_prefix)
|
| 127 |
|
| 128 |
+
# Route optimization (VRP/TSP + DBSCAN clustering + dynamic re-routing)
|
| 129 |
+
app.include_router(route_optimization_router, prefix=settings.api_prefix)
|
| 130 |
+
|
| 131 |
# Resources
|
| 132 |
app.include_router(drivers_router, prefix=settings.api_prefix)
|
| 133 |
app.include_router(routes_router, prefix=settings.api_prefix)
|
|
|
|
| 192 |
"database": "connected" if db_ok else "sqlite_fallback",
|
| 193 |
"version": settings.app_version,
|
| 194 |
"agents": ["ml_effort", "route_planner", "fairness_manager", "driver_liaison", "final_resolution", "explainability"],
|
| 195 |
+
"optimization": ["vrp_tsp", "2_opt", "dbscan_clustering", "time_windows", "dynamic_reroute"],
|
| 196 |
"langgraph": True,
|
| 197 |
"lorri_integration": True,
|
| 198 |
}
|