Project Story
What inspired us The devastating reality of Nepal's infrastructure is that manual, unoptimized road alignments frequently lead to deadly landslides, traffic congestion, and endless construction delays. We were deeply inspired by the urgency to fix this, especially in light of the new government's 100-point governance reform agenda, which strictly targets the faster execution of stalled national pride projects and infrastructure monitoring. We wanted to eliminate the guesswork and delays in road tenders by providing a tool that instantly calculates mathematically proven, safe, and cost-effective alignments.
How we built our project
We built OptiRoute AI as an autonomous civil engineering agent. Our React-Leaflet frontend captures user coordinate waypoints and sends them to a Node.js backend powered by the gemini-3.1-pro-preview model. To achieve true spatial reasoning, we combined two powerful Gemini API features:
- Grounding with Google Maps: This gave the AI real-time, real-world context regarding elevation, terrain, and existing infrastructure across Nepal.
- Python Code Execution: Instead of building a heavy, traditional GIS system, we prompted Gemini to autonomously write and execute an LLM-driven genetic search algorithm within its secure sandbox. The algorithm evaluates candidate alignments using a multi-objective fitness function to minimize earthwork costs and geohazard risks.
The model then outputs the optimized route as a Matplotlib graph and a structured GeoJSON object, which we render directly on our interactive map frontend.
The challenges we faced
One major challenge was ensuring the complex genetic algorithm could successfully compile, execute, and return results within the Gemini Code Execution environment's strict 30-second timeout limit. We also had to heavily utilize prompt engineering and the API's Structured Outputs (JSON schema enforcement) to ensure the AI perfectly returned a valid GeoJSON FeatureCollection alongside the visual data without breaking the application.
What we learned We learned how to move beyond basic chatbot wrappers to orchestrate true agentic workflows. We discovered the immense potential of fusing an LLM's semantic reasoning with structured mathematical search algorithms, proving that AI can serve as a highly capable, autonomous optimization engine for complex civil engineering and urban planning tasks.
Built With
- express.js
- grounding-with-google-maps
- matplotlib
- node.js
- numpy
- python
- react
- react-leaflet
- tailwind-css
Log in or sign up for Devpost to join the conversation.