📦 Smart Inventory Optimization Simulator
This project is a Streamlit-based real-time simulation app for smart inventory optimization in manufacturing. It integrates AI-powered demand forecasting (via an ensemble model) with deterministic order-up-to inventory control to dynamically maintain optimal stock levels.
Designed for short hackathons and production demos, the app shows how an enterprise like AuraTech Electronics can minimize total cost by balancing holding costs and stockout penalties, powered by machine learning predictions.
In modern manufacturing, managing critical components means finding a balance between:
- 📈 Overstocking → High holding & obsolescence costs
- 📉 Understocking → Lost sales & production delays
This app simulates that tradeoff in real time:
- Uses a trained ensemble model (MLP + LSTM + CNN + Meta-learner) to forecast daily demand.
- Computes an optimal inventory level (S) and order quantity (Q) using a cost-driven deterministic rule.
- Streams an animated simulation showing:
- Predicted vs actual demand
- Inventory levels over time
- Order decisions
- Accumulated cost metrics
- ✅ Forecasts daily demand using an ensemble ML model (.pkl)
- ✅ Implements order-up-to (S, Q) inventory policy
- ✅ Calculates holding cost and stockout cost dynamically
- ✅ Real-time simulation & visualization with animated charts
- ✅ Fully interactive Streamlit UI
- ✅ No need for full history data — uses only last 30 days CSV
The .pkl ensemble includes:
mlp_model,lstm_model,cnn_model,meta_modelscaler,sequence_length, andfeature_columns
The app reads your sku1_last_30days.csv as the rolling window for context.
Forecasts next-day demand using ensemble.
Calculates order-up-to level:
where
Each day, the app updates inventory, places orders (with supplier lead time), and computes total cost.
Visualization updates dynamically for each step.
📦 OneAI_InventoryOptimization
├── app.py # Main Streamlit app
├── ensemble_forecast_model.pkl # Trained model (root copy)
├── sku1_last_30days.csv # Last 30 days data (root copy)
├── requirements.txt # Python dependencies
├── README.md # This file
├── comparsion/ # Model comparison notebooks & graphs
│ ├── arima.ipynb
│ ├── prophet.ipynb
│ ├── arima_graph.png
│ └── prophet_graph.png
├── inference_files/ # Inference-ready assets
│ ├── ensemble_forecast_model.pkl
│ ├── prediction.py
│ └── sku1_last_30days.csv
└── Research/ # Research notes and notebooks
├── optimal-inventory.ipynb
├── README.md
└── research_mind_map.png
1️⃣ Clone the Repository
git clone https://github.com/sehat-inc/OneAI_InventoryOptimization
cd OneAI_InventoryOptimization
2️⃣ Install Dependencies
You can install the required packages using pip:
pip install -r requirements.txt
Or install manually:
pip install streamlit pandas numpy scipy tensorflow scikit-learn matplotlib
(You can add pickle-mixin or keras if required by your model.)
1️⃣ Place your files:
ensemble_forecast_model.pkl— trained ensemble modelsku1_last_30days.csv— recent 30-day SKU data
2️⃣ Run Streamlit:
streamlit run app.py
3️⃣ Configure in the Sidebar:
- Model Path:
ensemble_forecast_model.pkl - Last 30 Days CSV:
sku1_last_30days.csv - Set lead time, horizon, and cost parameters
- Hit “🚀 Start Simulation”
- Line Chart: Displays forecasted vs actual demand and inventory levels over time.
- Bar Chart: Shows order quantities and target inventory (S-level).
- KPIs: Real-time metrics for inventory, open orders, total cost, and order decisions.
- Event Log: Daily trace of forecasts, arrivals, and inventory actions.
- Manufacturing plants forecasting critical components
- Retail chains managing warehouse stock
- Hackathons or research projects in supply chain optimization
- Teaching demos for AI-driven operations management
Deterministic (s, S) control policy
Per-day cost function:
Order decision:
Forecast models can be replaced with any .pkl returning a single-day prediction.
Developed by:
- Sehat Gang — GIKI
For: OneAI Hackathon
# Install dependencies
pip install streamlit pandas numpy scipy tensorflow scikit-learn matplotlib
# Launch the simulation
streamlit run app.py