Have you ever wondered how companies can design their supply chains to be both environmentally friendly and economically viable?
Today, we’re diving into this fascinating challenge with a concrete example and Python solution!
The Green Supply Chain Challenge
Let’s consider a company that manufactures eco-friendly products and needs to design a supply chain network with multiple suppliers, manufacturing facilities, and distribution centers.
The company wants to:
- Minimize total carbon emissions
- Minimize total cost
- Meet customer demand
This is a classic multi-objective optimization problem where we need to find the optimal balance between environmental impact and economic considerations.
A Practical Example: Manufacturing with Green Choices
Consider a company that can source materials from 3 different suppliers, produce at 2 manufacturing facilities, and distribute through 3 distribution centers to meet customer demand.
Each combination has different costs and carbon emissions.
Let’s solve this with Python and visualize the results!
1 | import numpy as np |
Explaining the Green Supply Chain Optimization Model
Our Python code implements a multi-objective optimization model for a green supply chain. Let’s break down the key components:
1. Problem Definition
We’re modeling a supply chain with:
- 3 suppliers
- 2 manufacturing facilities
- 3 distribution centers
Each route has associated costs and carbon emissions.
The goal is to find the optimal flow of materials that minimizes both while meeting all constraints.
2. Mathematical Model
The optimization problem can be mathematically expressed as:
$$\text{Minimize: } \alpha \sum_{s=1}^{S} \sum_{f=1}^{F} \sum_{d=1}^{D} (c_{sf} + c_{fd}) x_{sfd} + (1-\alpha) \sum_{s=1}^{S} \sum_{f=1}^{F} \sum_{d=1}^{D} (e_{sf} + e_{fd}) x_{sfd}$$
Subject to:
- Demand constraints: $\sum_{s=1}^{S} \sum_{f=1}^{F} x_{sfd} = d_d, \forall d \in D$
- Factory capacity: $\sum_{s=1}^{S} \sum_{d=1}^{D} x_{sfd} \leq cap_f, \forall f \in F$
- Supplier capacity: $\sum_{f=1}^{F} \sum_{d=1}^{D} x_{sfd} \leq sup_s, \forall s \in S$
- Non-negativity: $x_{sfd} \geq 0, \forall s \in S, f \in F, d \in D$
Where:
- $\alpha$ is the weight given to cost (vs. carbon)
- $c_{sf}$ is the transportation cost from supplier s to factory f
- $c_{fd}$ is the transportation cost from factory f to distribution center d
- $e_{sf}$ and $e_{fd}$ are corresponding carbon emissions
- $x_{sfd}$ is the flow quantity from supplier s through factory f to distribution center d
3. Key Code Functions
The code implements several important functions:
supply_chain_cost(): Calculates the total costsupply_chain_carbon(): Calculates total carbon emissionsobjective_function(): Combines cost and carbon objectives with weights- Constraint functions ensure:
- All demands are met
- Factory capacities aren’t exceeded
- Supplier capacities aren’t exceeded
4. Multi-Objective Approach
We use a weighted sum approach, where:
weight_cost: Importance of cost minimization (0-1)weight_carbon: Importance of carbon minimization (0-1)
By varying these weights (0.0, 0.1, 0.2, …, 1.0), we generate different solutions along the Pareto front.
Analyzing the Results
Let’s examine the visualizations produced by our code:
The Pareto Front
Weight cost: 0.0, Weight carbon: 1.0, Cost: 308438.41, Carbon: 117146.14 Weight cost: 0.1, Weight carbon: 0.9, Cost: 307784.46, Carbon: 117488.92 Weight cost: 0.2, Weight carbon: 0.8, Cost: 306437.63, Carbon: 118363.02 Weight cost: 0.3, Weight carbon: 0.7, Cost: 305915.35, Carbon: 118611.49 Weight cost: 0.4, Weight carbon: 0.6, Cost: 305066.62, Carbon: 118339.98 Weight cost: 0.5, Weight carbon: 0.5, Cost: 298500.00, Carbon: 151749.93 Weight cost: 0.6, Weight carbon: 0.4, Cost: 298499.99, Carbon: 151749.95 Weight cost: 0.7, Weight carbon: 0.3, Cost: 298499.98, Carbon: 151749.96 Weight cost: 0.8, Weight carbon: 0.2, Cost: 298499.97, Carbon: 151749.98 Weight cost: 0.9, Weight carbon: 0.1, Cost: 298499.97, Carbon: 151750.00 Weight cost: 1.0, Weight carbon: 0.0, Cost: 298499.96, Carbon: 151750.02

This graph shows the trade-off between cost and carbon emissions.
Each point represents a different solution with different weights.
Points on the lower left would be ideal (low cost, low emissions), but this perfect scenario is usually unattainable.
Key observations:
- The cost-optimized solution (weight_cost = 1.0) gives the lowest cost but highest emissions
- The carbon-optimized solution (weight_cost = 0.0) gives the lowest emissions but highest cost
- Middle points offer different compromises between environmental and economic objectives
The Optimal Flow Network

This visualization shows the material flow for the balanced solution (weight_cost = 0.5, weight_carbon = 0.5). The numbers on the edges indicate the flow quantities.
We can see:
- Supplier 1 primarily serves Factory 2
- Supplier 2 primarily serves Factory 1
- Supplier 3 serves both factories
- Factory 1 handles Distribution Centers 1 and 3
- Factory 2 handles all Distribution Centers with emphasis on DC 2
Flow Heatmaps

These heatmaps provide a clearer view of the flow quantities:
- The left heatmap shows flows from suppliers to factories
- The right heatmap shows flows from factories to distribution centers
The deeper green colors indicate larger flows.
Weight Effects on Objectives

Trade-off Analysis Table:
Cost Weight Carbon Weight Total Cost Total Carbon Cost % of Max \
0 0.00 1.00 308438.41 117146.14 100.00
1 0.10 0.90 307784.46 117488.92 93.42
2 0.20 0.80 306437.63 118363.02 79.87
3 0.30 0.70 305915.35 118611.49 74.61
4 0.40 0.60 305066.62 118339.98 66.07
5 0.50 0.50 298500.00 151749.93 0.00
6 0.60 0.40 298499.99 151749.95 0.00
7 0.70 0.30 298499.98 151749.96 0.00
8 0.80 0.20 298499.97 151749.98 0.00
9 0.90 0.10 298499.97 151750.00 0.00
10 1.00 0.00 298499.96 151750.02 0.00
Carbon % of Max
0 0.00
1 0.99
2 3.52
3 4.23
4 3.45
5 100.00
6 100.00
7 100.00
8 100.00
9 100.00
10 100.00
Mathematical Model:
Minimize: $\alpha \sum_{s=1}^{S} \sum_{f=1}^{F} \sum_{d=1}^{D} (c_{sf} + c_{fd}) x_{sfd} + (1-\alpha) \sum_{s=1}^{S} \sum_{f=1}^{F} \sum_{d=1}^{D} (e_{sf} + e_{fd}) x_{sfd}$
Subject to:
$\sum_{s=1}^{S} \sum_{f=1}^{F} x_{sfd} = d_d, \forall d \in D$ (Demand Constraints)
$\sum_{s=1}^{S} \sum_{d=1}^{D} x_{sfd} \leq cap_f, \forall f \in F$ (Factory Capacity Constraints)
$\sum_{f=1}^{F} \sum_{d=1}^{D} x_{sfd} \leq sup_s, \forall s \in S$ (Supplier Capacity Constraints)
$x_{sfd} \geq 0, \forall s \in S, f \in F, d \in D$ (Non-negativity Constraints)
This graph shows how changing the weight on cost (vs. carbon) affects both objectives:
- As we increase the weight on cost, total cost decreases
- As we increase the weight on cost, carbon emissions increase
- The relationship isn’t linear, showing the complex nature of the trade-offs
Business Insights from the Results
No “Perfect” Solution: There’s always a trade-off between economic and environmental objectives. Businesses must decide which balance aligns with their sustainability goals and economic constraints.
Marginal Costs of Green Initiatives: The varying steepness of the Pareto front shows that some environmental improvements can be made with minimal cost increases, while others become increasingly expensive.
Strategic Decision Making: Companies can use this approach to:
- Quantify the cost of reducing carbon emissions
- Set realistic sustainability targets
- Make data-driven supply chain decisions
Policy Implications: If carbon taxes or incentives are implemented, the optimal solution will shift. This model can help analyze the impact of such policies.
Implementation Considerations
In real-world scenarios, you might want to expand this model to include:
- Multiple time periods for planning
- Uncertainty in demand, costs, or emissions
- More detailed transportation modes with different emissions profiles
- Facility location decisions
- Inventory holding costs and carbon impacts
Conclusion
Our Python model demonstrates how companies can systematically approach the challenge of designing sustainable supply chains that balance environmental and economic objectives.
By generating the Pareto front of solutions, decision-makers can visualize the trade-offs and choose a solution that aligns with their sustainability strategy.
The multi-objective approach is flexible and can be adapted to different industries and supply chain configurations.
As sustainability becomes increasingly important, these types of models will be essential tools for supply chain managers and sustainability officers.
Note: This model is a simplified example.
Real-world implementations would require more detailed data and possibly additional constraints specific to the industry and business context.























