Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created November 9, 2025 13:42
Show Gist options
  • Select an option

  • Save samirsaci/6c80e80068a0995a674c9a427c6efd22 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/6c80e80068a0995a674c9a427c6efd22 to your computer and use it in GitHub Desktop.
MCP Server Supply Chain Optimisation - Doc String Interprete Results
"""
HOW TO READ THIS RUN (based on the sample JSON)
-----------------------------------------------
- Objective = cost: the model opens 4 plants (INDIA-LOW, JAPAN-HIGH, BRAZIL-HIGH, INDIA-HIGH),
heavily exporting from INDIA and BRAZIL to the USA, while JAPAN supplies itself.
- Unit economics: unit_cost ≈ €116.10; total_costs ≈ €5.683M (divide by 1e6 for M€).
- Market economics: “JAPAN” is the most expensive market; “INDIA” the cheapest.
- Localization ratio: local_prod / total_prod = 18,050 / 48,950 ≈ 36.87% local, 63.13% export.
- Footprint per unit: e.g., unit_co2 ≈ 35.55 kgCO₂e/unit. To approximate total CO₂:
unit_co2 * total_units ≈ 35.55 * 48,950 ≈ 1,740,100 kgCO₂e (≈ 1,740 tCO₂e).QUICK SANITY CHECKS
-------------------
- Demand balance: sum_i flow(i→j) == demand(j) for each market j.
- Capacity: sum_j flow(i→j) ≤ sum_s CAP(i,s) * open(i,s) for each i.
- Unit-cost check: total_costs / total_units == unit_cost.
- If infeasible: your per-unit caps (max_water/energy/waste/CO₂) may be too tight.
TYPICAL USES
------------
- Baseline vs. sustainability: run once with objective="Production Cost", then with
objective="CO2 Emissions" (or Water/Energy) using the same caps to quantify the
trade-off (Δcost, Δunit_CO₂, change in plant openings/flows).
- Narrative for execs: report top flows (e.g., INDIA→USA=15.5k, BRAZIL→USA=12.5k),
open sites, unit cost, and per-unit footprints. Convert costs to M€ with unit_monetary.
EXAMPLES
--------
# Min cost baseline
run_network(LaunchParamsNetwork(objective="Production Cost"))
# Minimize CO₂ with a water cap
run_network(LaunchParamsNetwork(objective="CO2 Emissions", max_water=3500))
# Minimize Water with an energy cap
run_network(LaunchParamsNetwork(objective="Water Usage", max_energy=780))
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment