A comprehensive library for analyzing waste in supply chain networks using advanced network analysis and causal inference.
Think of a food supply chain as a complex web of relationships between different players: farmers, processors, warehouses, stores, and service providers. Each connection in this web can lead to food waste, but understanding exactly how and why waste occurs is challenging. This tool helps solve that challenge by:
- Mapping the Network: Creating a digital twin of your supply chain that shows how food, services, and money flow between different players
- Finding Waste Hotspots: Using advanced math to identify where waste is most likely to occur
- Understanding Causes: Using AI and statistics to figure out what factors (like storage time or temperature) most affect waste
- Testing Solutions: Allowing you to simulate different solutions (like better cold storage) to see their impact
- Initial Producers (e.g., farms): Where food enters the system
- Food Processors (e.g., packaging facilities): Where food is transformed
- Food Handlers (e.g., warehouses): Where food is stored and moved
- End Consumers (e.g., stores): Where food exits the system
- Service Providers (e.g., cold chain services): Who help reduce waste
- Inventory Flow (solid blue lines): Shows how food moves
- Service Flow (dashed red lines): Shows who's helping who
- Currency Flow (dotted green lines): Shows how money moves
We calculate waste in three ways:
- Static: Fixed percentage (e.g., 5% always lost)
- Time-based: Increases with time (e.g., 1% per day)
- Multi-factor: Based on conditions (e.g., temperature, humidity)
- Advanced network model with flow-specific path finding
- Bayesian causal analysis with regression capabilities
- Visualization tools for network structure and statistical analysis
- Inventory loss prediction and analysis
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
This is like a Google Maps for your supply chain:
- Each dot (node) is a player in your system
- Lines between dots show how they're connected
- Colors tell you what type of player each dot represents
- Line styles show what's flowing between players
Key things to look for:
- Thicker lines = more flow
- Red highlights = potential problem areas
- Numbers on lines = amount of waste
This chart shows where waste is happening:
- Each bar represents a location
- Height of bar shows how much waste occurs there
- Colors match the network map for easy reference
- Total waste shown at top
This helps understand why waste occurs:
- Numbers show how strong each factor's effect is
- Larger numbers = stronger effect
- ± shows uncertainty in the measurement
- R² score (0-1) shows how well we understand the system
Example interpretation:
Storage Time: 0.32 ± 0.017 (R² = 0.85)
Means:
- Every day in storage increases waste by about 0.32%
- We're quite certain (small ± number)
- Our model explains 85% of waste variation (good fit)
See the examples/
directory for detailed examples:
Shows how to:
- Create a simple supply chain
- Add basic waste calculations
- Visualize the network
Shows how to:
- Use causal analysis
- Model complex relationships
- Test different solutions
A complete example using:
- Real-world-like data
- Multiple node types
- All flow types
- Complex waste functions
-
Find Problem Areas
- Look for red highlights in network map
- Check highest bars in waste breakdown
- Focus on strongest effects in causal analysis
-
Choose Solutions
- Use service providers where effects are strongest
- Optimize paths with least waste
- Target interventions based on causal factors
-
Monitor Progress
- Track total system waste over time
- Watch for changes in causal factors
- Measure solution effectiveness
For detailed mathematical formulation and methodology, see the whitepaper in the whitepaper/
directory.
Contributions are welcome! Please read our contributing guidelines and code of conduct.
This project is licensed under the MIT License - see the LICENSE file for details.