EcoCartAI / README.md
Esvanth's picture
Add Hugging Face Space metadata frontmatter
1a5505d
metadata
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