Skip to content

Applying classical Operations Research (EOQ, Safety Stock) to optimize Hyperscale Cloud Infrastructure capacity planning and minimize TCO.

License

Notifications You must be signed in to change notification settings

sandesh-s-hegde/digital_capacity_optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

182 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿš› LSP Digital Capacity Twin: Multi-Modal Stochastic Engine

Author: Sandesh Hegde
Version: v3.8.0 (Strategic Research Edition)

Python Streamlit License Status Cloud

๐Ÿš€ Live Demo

Click here to launch the Research Artifact (Note: Hosted on Render Free Tier. Please allow 30s for cold start.)


๐Ÿ“– Executive Summary

This artifact operationalizes the "Pixels to Premiums" research framework, serving as a Decision Support System (DSS) for Logistics Service Providers (LSPs). It now includes a Global Sourcing Simulator to quantify the "China Plus One" strategy and the impact of Free Trade Agreements (FTAs).


๐Ÿงฎ Methodological Framework

1. Multi-Modal Trade-off Logic

The engine applies strategic multipliers to simulate mode-specific constraints. The "Iron Triangle" of Logistics is modeled as:

  • Lead Time ($L_m$): $L_{base} \times M_{time}$ (e.g., Air = 0.2x, Rail = 1.5x)
  • Unit Cost ($C_m$): $C_{base} \times M_{cost}$ (e.g., Air = 3.0x, Rail = 0.7x)
  • Emissions ($E_m$): $E_{base} \times M_{co2}$ (e.g., Air = 5.0x, Rail = 0.3x)

2. Total Landed Cost (TLC) Model (New!)

To compare Domestic vs. Offshore sourcing, the system calculates the hidden cost of risk:

$$\text{TLC} = \text{Base Price} + \text{Freight} + \text{Duty} + \left( \frac{\text{Lead Time}}{365} \times \text{Demand} \times \text{Holding Rate} \right)$$

3. Monte Carlo Risk Engine

To quantify financial tail risk, the system runs 10,000 stochastic iterations for every scenario. Instead of a single "average" profit, we generate a probability distribution:

$$P_{sim} = (D_{stoch} \cdot SP) - (Q_{order} \cdot UC_{mode}) - (I_{safety} \cdot H) - (S_{missed} \cdot \pi)$$

  • Metric: Value at Risk (VaR 95%) = The worst 5% financial outcome.

4. Volatility Modelling (RSS)

The system calculates Risk-Adjusted Safety Stock using a Root Sum of Squares approach, integrating demand variability ($\sigma_{D}$) and lead time variability ($\sigma_{LT}$):

$$\text{Safety Stock} = Z_{\alpha}\sqrt{(\overline{L}\sigma_{D}^{2})+(\overline{D}^{2}\sigma_{LT}^{2})}$$


๐Ÿš€ Key Features (v3.8.0)

๐Ÿšš 1. Multi-Modal Transport Engine

  • Mode Selection: Toggle between Road (Standard), Rail (Green/Slow), and Air (Express/Costly).
  • Dynamic Economics: "Air Mode" instantly triples costs and spikes CO2, but slashes lead time to near zero.
  • Impact Analysis: See how switching to Rail affects your stockout risk due to slower replenishment.

๐ŸŒ 2. Global Sourcing Strategy (New in v3.8!)

  • "China Plus One" Simulator: Compares Domestic/Nearshore sourcing against Offshore (e.g., India) sourcing.
  • Trade Policy Lever: Interactive Tariff slider (0-20%) to test the viability of Free Trade Agreements (FTAs).
  • Risk vs. Reward: Visualizes the "tipping point" where logistics risk outweighs labor cost savings.

๐ŸŒ 3. Strategic Scorecard (Triple Bottom Line)

  • Sustainability: Tracks CO2 Emissions (kg) and calculates "Green Savings" from modal shifts.
  • Customer Loyalty: Dynamic score based on Fill Rate reliability vs. SLA targets.
  • Resilience Score: Composite index (0-100) measuring network robustness.

๐ŸŒช๏ธ 4. Disruption Simulator

  • "Stress Test" Mode: Simulates a Supply Chain Shock (e.g., Port Strike).
  • Real-Time Impact: Instantly doubles lead time variance ($\sigma_{LT}$), crashing Resilience Scores in real-time.

๐Ÿ”ฌ 5. Research Laboratory (Enhanced)

  • Stochastic Validation: Runs 10,000 iterations to prove the "Newsvendor Optimal" strategy.
  • Loss Predictability: New metric quantifying the Probability of Loss (%) to identify dangerous cost structures.
  • Profit Heatmaps: Visualizes the "Zone of Profitability" across demand and volatility scenarios.

โš™๏ธ Technical Architecture

  • Core Logic: numpy (Monte Carlo) & scipy.stats (Stochastic Calculus).
  • Intelligence Layer: Google Gemini 1.5 Flash (via ai_brain.py) for strategic context.
  • Visualization: plotly.graph_objects (Geospatial & Risk Histograms).
  • CI/CD: GitHub Actions (Automated Testing & Deployment).
  • Frontend: Streamlit (React-based) for interactive simulation.

๐Ÿš€ Installation & Usage

Prerequisites

You need a Google AI Studio API Key.

Option A: Run Locally (Python)

# 1. Clone the repository
git clone https://github.com/sandesh-s-hegde/digital_capacity_optimizer.git
cd digital_capacity_optimizer

# 2. Install dependencies
pip install -r requirements.txt

# 3. Set your API Key (Create a .env file)
# GOOGLE_API_KEY="AIzaSy..."
# DATABASE_URL="postgresql://..."

# 4. Generate Research Data (Optional)
python seed_data.py

# 5. Launch the Digital Twin
streamlit run app.py

๐Ÿ“„ Citation

If you use this software in your research, please cite it as follows:

Harvard Style:

Hegde, S.S. (2026). LSP Digital Capacity Twin: Multi-Modal Stochastic Engine (Version 3.8.0) [Software]. Available at: https://github.com/sandesh-s-hegde/digital_capacity_optimizer

BibTeX:

@software {Hegde_LSP_Digital_Twin_2026,
  author = {Hegde, Sandesh Subramanya},
  month = feb,
  title = {LSP Digital Capacity Twin: Multi-Modal Stochastic Engine},
  url = {(https://github.com/sandesh-s-hegde/digital_capacity_optimizer)},
  version = {3.8.0},
  year = {2026}
}

๐Ÿ”ฎ Roadmap

Phase Maturity Level Key Capabilities Status
Phase 1 Descriptive Static Rule-Based Logic (EOQ) โœ… Done
Phase 2 Predictive Cloud Database + Forecasting โœ… Done
Phase 3 Stochastic Multi-Modal, Monte Carlo & Resilience, Research โœ… Released (v3.8)
Phase 4 Strategic Global Sourcing (FTA) & Trade Policy โœ… Released (v3.8)
Phase 5 Autonomous Multi-Echelon Reinforcement Learning ๐Ÿšง Planned