title: EcoCart AI System
emoji: π
colorFrom: green
colorTo: blue
sdk: streamlit
sdk_version: 1.57.0
app_file: app.py
pinned: false
EcoCart AI System
An interactive AI-powered logistics simulation
Live Demo: Launch on Streamlit
What is EcoCart?
EcoCart is a mid-sized e-commerce company facing challenges in optimising its logistics network. This project proposes an AI-based solution across six tasks β from intelligent delivery agents to demand forecasting and business ROI analysis.
Tasks Covered
Task 1 β AI Agents
Demonstrates three types of AI agents navigating a delivery map in real time:
- Reactive Agent β goes to the nearest stop, no planning
- Goal-Based Agent β plans the full route before departing (2-opt optimised)
- Utility-Based Agent β balances urgency vs distance to prioritise high-value stops
Task 2 β Bias Detection & Mitigation
Uses K-Means clustering to segment customers into value tiers. Detects urban/rural bias using Disparate Impact (DI) analysis and applies a three-step mitigation strategy:
- Oversample rural customers to balance the dataset
- Adjust spend for delivery cost premium (+β¬12)
- Adjust frequency for rural order batching (Γ1.5)
Task 3 β Search Algorithms for Route Optimisation
Implements all four search algorithms on a 20-node urban/rural delivery network:
- BFS β Breadth-First Search
- DFS β Depth-First Search
- A* β Best-first with Euclidean heuristic
- IDA* β Iterative Deepening A*
Includes a live exploration replay slider β drag to watch the algorithm search node by node.
Task 4 β A* vs IDA* Comparative Analysis
Benchmarks both algorithms on 10 origin-destination pairs (5 urban, 5 rural) over multiple timing runs. Compares nodes expanded, average time, and memory behaviour.
Task 5 β Demand Forecasting
Trains two ML models on 730 days of synthetic sales data:
- Linear Regression β fast and interpretable
- Random Forest β captures non-linear seasonal patterns
Features a what-if predictor β enter any day, month, and promotion flag to get an instant sales prediction.
Task 6 β Business Case (Voluntary β AI Student)
Quantifies the financial and environmental impact of the AI system with fully interactive sliders:
- ROI calculator β adjusts fleet size, fuel cost, wage rates and shows live annual savings
- 3-year ROI projection β cumulative benefit vs cost with breakeven line
- COβ impact β tonnes saved per year, tree and car equivalents
- Implementation roadmap β 5-phase Gantt chart across 8 months
Tech Stack
| Tool | Purpose |
|---|---|
| Python 3.11 | Core language |
| Streamlit | Interactive web app |
| Plotly | Interactive charts |
| scikit-learn | K-Means, LR, Random Forest |
| NumPy / Pandas | Data processing |
Run Locally
pip install -r requirements.txt
streamlit run app.py
Project Structure
FAI SIMULATION/
βββ app.py # Main Streamlit app (all 6 tasks)
βββ task2_segmentation.py # Standalone Task 2 script
βββ task3_4_routing.py # Standalone Tasks 3 & 4 script
βββ task5_forecasting.py # Standalone Task 5 script
βββ data/ # Synthetic datasets (loaded by every task)
β βββ customers.csv # Task 2 β 400 customer records
β βββ sales_history.csv # Task 5 β 730 days of daily sales
β βββ network_nodes.csv # Tasks 3/4 β 20-node delivery network
β βββ network_edges.csv # Tasks 3/4 β edge weights + COβ cost
β βββ export_data.py # Regenerates the CSVs from a fixed seed
βββ requirements.txt # Python dependencies
βββ README.md
Dataset
All data is synthetic and reproducible. The CSVs in data/ are the
program's data source β every task script (task2_segmentation.py,
task3_4_routing.py, task5_forecasting.py) loads its inputs directly
from these files at runtime:
| File | Rows | Description |
|---|---|---|
customers.csv |
400 | 300 urban + 100 rural customers (deliberately biased) |
sales_history.csv |
730 | Daily sales with weekly + yearly seasonality + promos |
network_nodes.csv |
20 | Delivery hubs (x, y, urban/rural) |
network_edges.csv |
34 | Roads with distance (km) and COβ cost (kg) |
The CSVs themselves are generated from an inline source-of-truth with a
fixed random seed (np.random.default_rng(42)). To rebuild them:
python data/export_data.py
Author
Esvanth Mohankumar
Student ID: 24311073
Programme: MSc Artificial Intelligence
College: National College of Ireland
Module: Foundations of AI