Dataset Viewer
Auto-converted to Parquet Duplicate
scenario_id
stringlengths
17
34
prompt
stringlengths
4.45k
7.03k
data
stringlengths
2.79k
5.46k
reference_status
stringclasses
2 values
reference_objective
float64
307k
5.8M
retail_f1_52_weeks_v0
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_52_weeks Scenario ID: retail_f1_52_weeks_v0 [BUSINESS DESCRIPTION] Business narrative: The retailer plans inventory over a full year of weekly decisions, represented by fifty-two time periods. Exogenous seasonal demand, local inventories at each distribution center, and per-product production capacities work as in the core operations baseline. Customers are never backordered; unmet demand in a week is immediately lost and penalized. The main difference is the extended planning horizon, which tests the ability to manage long-run seasonality and accumulation effects. Structure cues: - The inventory system is the same as in retail_f1_base, with multiple products, multiple locations, and capacity-limited production for each product and period. - The time index now runs for fifty-two periods. The same inventory evolution and demand fulfillment logic is applied in every period of the year. - At each location and for each product, stock at the end of a week depends on what was carried over, what was produced for that location during the week, and what was sold or discarded. Inventory cannot go below zero; any unmet demand in a week is lost and penalized. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - No transshipment and zero lead times in this scenario. - Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON. - The objective is to minimize total cost over the entire year, aggregating holding, waste, and lost sales costs across all weeks. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_52_weeks_v0", "description": "Standard seasonal retail scenario.", "periods": 52, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4000, "DC2": 3500, "DC3": 3000, "DC4": 3000, "DC5": 2500}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [303, 311, 328, 365, 435, 549, 711, 906, 1100, 1245, 1300, 1245, 1100, 906, 711, 549, 435, 365, 328, 311, 303, 311, 328, 365, 435, 549, 711, 906, 1100, 1245, 1300, 1245, 1100, 906, 711, 549, 435, 365, 328, 311, 303, 311, 328, 365, 435, 549, 711, 906, 1100, 1245, 1300, 1245], "SKU_Premium": [151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622, 550, 453, 355, 274, 217, 182, 164, 155, 151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622, 550, 453, 355, 274, 217, 182, 164, 155, 151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622], "SKU_ShortLife": [121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498, 440, 362, 284, 219, 174, 146, 131, 124, 121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498, 440, 362, 284, 219, 174, 146, 131, 124, 121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
1,006,432
retail_f1_52_weeks_v1
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_52_weeks Scenario ID: retail_f1_52_weeks_v1 [BUSINESS DESCRIPTION] Business narrative: The retailer plans inventory over a full year of weekly decisions, represented by fifty-two time periods. Exogenous seasonal demand, local inventories at each distribution center, and per-product production capacities work as in the core operations baseline. Customers are never backordered; unmet demand in a week is immediately lost and penalized. The main difference is the extended planning horizon, which tests the ability to manage long-run seasonality and accumulation effects. Structure cues: - The inventory system is the same as in retail_f1_base, with multiple products, multiple locations, and capacity-limited production for each product and period. - The time index now runs for fifty-two periods. The same inventory evolution and demand fulfillment logic is applied in every period of the year. - At each location and for each product, stock at the end of a week depends on what was carried over, what was produced for that location during the week, and what was sold or discarded. Inventory cannot go below zero; any unmet demand in a week is lost and penalized. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - No transshipment and zero lead times in this scenario. - Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON. - The objective is to minimize total cost over the entire year, aggregating holding, waste, and lost sales costs across all weeks. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_52_weeks_v1", "description": "Standard seasonal retail scenario.", "periods": 52, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 3483.5107111415105, "DC2": 3583.3567701844527, "DC3": 2823.773247022257, "DC4": 2587.2574205432406, "DC5": 2324.632357495927}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [289, 294, 338, 348, 445, 626, 729, 911, 1247, 1288, 1207, 1213, 1097, 889, 808, 617, 437, 408, 337, 286, 338, 272, 359, 320, 414, 515, 628, 935, 1045, 1377, 1398, 1128, 997, 865, 774, 628, 426, 350, 324, 274, 301, 298, 359, 358, 427, 495, 773, 1008, 1188, 1400, 1407, 1321], "SKU_Premium": [156, 132, 170, 180, 199, 301, 357, 470, 487, 563, 735, 569, 508, 391, 321, 259, 206, 181, 186, 176, 140, 159, 181, 205, 245, 276, 384, 459, 526, 691, 612, 572, 579, 421, 336, 278, 245, 183, 144, 161, 132, 150, 172, 157, 231, 301, 321, 456, 497, 682, 621, 626], "SKU_ShortLife": [114, 126, 122, 166, 193, 224, 262, 328, 458, 430, 475, 446, 419, 314, 309, 201, 152, 163, 142, 140, 124, 112, 113, 161, 169, 188, 252, 359, 486, 523, 580, 543, 409, 335, 249, 226, 151, 148, 147, 126, 119, 140, 136, 151, 170, 188, 315, 334, 402, 431, 469, 466]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
1,004,271.5
retail_f1_52_weeks_v2
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_52_weeks Scenario ID: retail_f1_52_weeks_v2 [BUSINESS DESCRIPTION] Business narrative: The retailer plans inventory over a full year of weekly decisions, represented by fifty-two time periods. Exogenous seasonal demand, local inventories at each distribution center, and per-product production capacities work as in the core operations baseline. Customers are never backordered; unmet demand in a week is immediately lost and penalized. The main difference is the extended planning horizon, which tests the ability to manage long-run seasonality and accumulation effects. Structure cues: - The inventory system is the same as in retail_f1_base, with multiple products, multiple locations, and capacity-limited production for each product and period. - The time index now runs for fifty-two periods. The same inventory evolution and demand fulfillment logic is applied in every period of the year. - At each location and for each product, stock at the end of a week depends on what was carried over, what was produced for that location during the week, and what was sold or discarded. Inventory cannot go below zero; any unmet demand in a week is lost and penalized. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - No transshipment and zero lead times in this scenario. - Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON. - The objective is to minimize total cost over the entire year, aggregating holding, waste, and lost sales costs across all weeks. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_52_weeks_v2", "description": "Standard seasonal retail scenario.", "periods": 52, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4291.310835751933, "DC2": 3586.8980554014483, "DC3": 2802.1254967501045, "DC4": 2560.502105140458, "DC5": 2521.5221885622987}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [331, 304, 318, 378, 411, 628, 792, 880, 1028, 1292, 1186, 1166, 1258, 808, 713, 621, 394, 343, 361, 348, 311, 345, 356, 403, 410, 611, 659, 983, 1013, 1172, 1257, 1291, 1053, 976, 737, 536, 435, 339, 306, 322, 303, 315, 335, 326, 458, 575, 717, 955, 1047, 1179, 1112, 1071], "SKU_Premium": [150, 172, 159, 162, 227, 279, 397, 400, 615, 691, 722, 707, 614, 473, 395, 261, 195, 181, 182, 168, 131, 174, 163, 182, 249, 308, 320, 514, 526, 645, 679, 673, 563, 435, 335, 279, 228, 192, 144, 149, 138, 152, 164, 167, 238, 301, 354, 456, 611, 643, 612, 601], "SKU_ShortLife": [138, 134, 146, 167, 154, 221, 249, 408, 460, 445, 532, 513, 453, 398, 303, 243, 199, 124, 121, 128, 127, 135, 122, 134, 158, 189, 272, 324, 408, 439, 540, 508, 471, 357, 308, 187, 173, 156, 129, 142, 137, 140, 116, 159, 175, 235, 256, 402, 492, 519, 455, 518]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
1,026,462.5
retail_f1_52_weeks_v3
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_52_weeks Scenario ID: retail_f1_52_weeks_v3 [BUSINESS DESCRIPTION] Business narrative: The retailer plans inventory over a full year of weekly decisions, represented by fifty-two time periods. Exogenous seasonal demand, local inventories at each distribution center, and per-product production capacities work as in the core operations baseline. Customers are never backordered; unmet demand in a week is immediately lost and penalized. The main difference is the extended planning horizon, which tests the ability to manage long-run seasonality and accumulation effects. Structure cues: - The inventory system is the same as in retail_f1_base, with multiple products, multiple locations, and capacity-limited production for each product and period. - The time index now runs for fifty-two periods. The same inventory evolution and demand fulfillment logic is applied in every period of the year. - At each location and for each product, stock at the end of a week depends on what was carried over, what was produced for that location during the week, and what was sold or discarded. Inventory cannot go below zero; any unmet demand in a week is lost and penalized. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - No transshipment and zero lead times in this scenario. - Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON. - The objective is to minimize total cost over the entire year, aggregating holding, waste, and lost sales costs across all weeks. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_52_weeks_v3", "description": "Standard seasonal retail scenario.", "periods": 52, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4580.392163478575, "DC2": 3714.3315490990617, "DC3": 3353.9465124536155, "DC4": 2764.352652808441, "DC5": 2583.456876146125}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [345, 287, 324, 310, 481, 539, 778, 883, 1037, 1367, 1242, 1250, 1135, 1025, 753, 498, 477, 357, 349, 298, 308, 320, 299, 376, 475, 485, 776, 846, 1026, 1409, 1114, 1198, 1256, 958, 709, 523, 465, 415, 374, 272, 283, 295, 375, 350, 500, 532, 605, 966, 1177, 1308, 1141, 1165], "SKU_Premium": [166, 144, 176, 208, 221, 312, 379, 416, 511, 604, 638, 667, 599, 488, 358, 312, 238, 190, 143, 155, 162, 158, 146, 168, 205, 311, 385, 455, 608, 600, 605, 606, 525, 386, 407, 279, 224, 165, 156, 147, 169, 150, 159, 197, 226, 242, 326, 435, 603, 607, 561, 544], "SKU_ShortLife": [121, 115, 145, 156, 148, 232, 311, 390, 394, 511, 448, 437, 499, 358, 272, 240, 180, 167, 122, 125, 106, 126, 111, 138, 190, 186, 312, 408, 404, 539, 458, 540, 475, 314, 316, 218, 158, 141, 119, 125, 115, 126, 142, 143, 179, 223, 306, 414, 483, 496, 443, 427]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
1,006,574.5
retail_f1_52_weeks_v4
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_52_weeks Scenario ID: retail_f1_52_weeks_v4 [BUSINESS DESCRIPTION] Business narrative: The retailer plans inventory over a full year of weekly decisions, represented by fifty-two time periods. Exogenous seasonal demand, local inventories at each distribution center, and per-product production capacities work as in the core operations baseline. Customers are never backordered; unmet demand in a week is immediately lost and penalized. The main difference is the extended planning horizon, which tests the ability to manage long-run seasonality and accumulation effects. Structure cues: - The inventory system is the same as in retail_f1_base, with multiple products, multiple locations, and capacity-limited production for each product and period. - The time index now runs for fifty-two periods. The same inventory evolution and demand fulfillment logic is applied in every period of the year. - At each location and for each product, stock at the end of a week depends on what was carried over, what was produced for that location during the week, and what was sold or discarded. Inventory cannot go below zero; any unmet demand in a week is lost and penalized. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - No transshipment and zero lead times in this scenario. - Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON. - The objective is to minimize total cost over the entire year, aggregating holding, waste, and lost sales costs across all weeks. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_52_weeks_v4", "description": "Standard seasonal retail scenario.", "periods": 52, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 3499.737385701882, "DC2": 3365.874638487682, "DC3": 2875.5852152529897, "DC4": 3022.249693724108, "DC5": 2610.05013090868}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [285, 270, 313, 317, 383, 529, 772, 913, 1046, 1281, 1329, 1234, 1081, 866, 801, 582, 487, 395, 362, 315, 301, 306, 368, 369, 458, 501, 808, 849, 1120, 1315, 1419, 1307, 1156, 903, 647, 484, 408, 336, 320, 278, 284, 337, 298, 382, 399, 581, 709, 918, 1023, 1127, 1342, 1281], "SKU_Premium": [158, 149, 150, 179, 201, 289, 334, 448, 525, 641, 715, 641, 523, 472, 329, 238, 236, 178, 184, 136, 155, 169, 177, 157, 186, 295, 342, 415, 555, 528, 726, 711, 485, 393, 373, 283, 230, 176, 180, 155, 168, 132, 155, 156, 212, 277, 388, 476, 485, 611, 737, 572], "SKU_ShortLife": [130, 137, 133, 144, 156, 234, 274, 396, 449, 467, 480, 508, 409, 373, 295, 226, 152, 135, 120, 118, 137, 106, 147, 149, 171, 241, 248, 329, 450, 437, 548, 572, 397, 404, 255, 226, 178, 144, 122, 136, 126, 120, 148, 127, 162, 207, 247, 337, 496, 436, 568, 548]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
1,006,442.5
retail_f1_base_v0
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_base Scenario ID: retail_f1_base_v0 [BUSINESS DESCRIPTION] Business narrative: The retailer manages weekly inventory for several products across multiple distribution centers that directly serve final customer demand. Demand for each product at each location is seasonal and exogenous. Products are replenished each period up to a per-product production or procurement capacity, and any demand that is not served immediately in the period is permanently lost and penalized. Customers are never backlogged or promised future delivery. Inventory is held locally at each distribution center, and there is no movement of stock between locations in this archetype. Structure cues: - Time is a discrete sequence of periods defined in the JSON. Decisions about how much to produce or procure and how much to ship to each location are made at the beginning of each period; demand is realized and served within that same period. - Inventory evolves by carrying over what remains from the previous period, adding any new production assigned to the location, and subtracting units that are sold or intentionally discarded as waste. On-hand stock is never allowed to become negative. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Any demand that cannot be met from available local inventory in the period is treated as lost sales and incurs the lost sales penalty. There is no concept of backorders, reservations, or delayed fulfillment. - Production for each product in each period cannot exceed the given production capacity. Production is available without delay in this archetype because lead times are effectively zero. - Storage capacity at each location and period limits the total volume of on-hand inventory using product-specific storage usage coefficients and location capacities from the JSON: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected even in periods where they do not bind. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory. - Labor capacity is set high enough that it does not bind in this archetype, but if labor constraints are included they must be consistent with the JSON parameters. - The objective is to minimize total cost over the horizon, including inventory holding costs, waste costs, and lost sales penalties. No fixed ordering costs, minimum order quantities, lead times, reverse flows, or global budgets are active here. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_base_v0", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4000, "DC2": 3500, "DC3": 3000, "DC4": 3000, "DC5": 2500}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [303, 311, 328, 365, 435, 549, 711, 906, 1100, 1245, 1300, 1245, 1100, 906, 711, 549, 435, 365, 328, 311], "SKU_Premium": [151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622, 550, 453, 355, 274, 217, 182, 164, 155], "SKU_ShortLife": [121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498, 440, 362, 284, 219, 174, 146, 131, 124]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
378,951.5
retail_f1_base_v1
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_base Scenario ID: retail_f1_base_v1 [BUSINESS DESCRIPTION] Business narrative: The retailer manages weekly inventory for several products across multiple distribution centers that directly serve final customer demand. Demand for each product at each location is seasonal and exogenous. Products are replenished each period up to a per-product production or procurement capacity, and any demand that is not served immediately in the period is permanently lost and penalized. Customers are never backlogged or promised future delivery. Inventory is held locally at each distribution center, and there is no movement of stock between locations in this archetype. Structure cues: - Time is a discrete sequence of periods defined in the JSON. Decisions about how much to produce or procure and how much to ship to each location are made at the beginning of each period; demand is realized and served within that same period. - Inventory evolves by carrying over what remains from the previous period, adding any new production assigned to the location, and subtracting units that are sold or intentionally discarded as waste. On-hand stock is never allowed to become negative. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Any demand that cannot be met from available local inventory in the period is treated as lost sales and incurs the lost sales penalty. There is no concept of backorders, reservations, or delayed fulfillment. - Production for each product in each period cannot exceed the given production capacity. Production is available without delay in this archetype because lead times are effectively zero. - Storage capacity at each location and period limits the total volume of on-hand inventory using product-specific storage usage coefficients and location capacities from the JSON: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected even in periods where they do not bind. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory. - Labor capacity is set high enough that it does not bind in this archetype, but if labor constraints are included they must be consistent with the JSON parameters. - The objective is to minimize total cost over the horizon, including inventory holding costs, waste costs, and lost sales penalties. No fixed ordering costs, minimum order quantities, lead times, reverse flows, or global budgets are active here. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_base_v1", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 3533.9579113297223, "DC2": 3317.622259031674, "DC3": 2662.2471240015657, "DC4": 2571.1157376641754, "DC5": 2208.3235255734785}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [258, 307, 329, 349, 465, 513, 673, 868, 1079, 1397, 1353, 1185, 945, 825, 787, 516, 420, 330, 329, 307], "SKU_Premium": [150, 151, 166, 207, 245, 312, 372, 392, 582, 679, 639, 681, 559, 387, 338, 302, 191, 198, 179, 165], "SKU_ShortLife": [131, 120, 144, 164, 175, 218, 293, 361, 396, 444, 569, 492, 422, 386, 323, 249, 192, 157, 137, 136]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
379,803
retail_f1_base_v2
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_base Scenario ID: retail_f1_base_v2 [BUSINESS DESCRIPTION] Business narrative: The retailer manages weekly inventory for several products across multiple distribution centers that directly serve final customer demand. Demand for each product at each location is seasonal and exogenous. Products are replenished each period up to a per-product production or procurement capacity, and any demand that is not served immediately in the period is permanently lost and penalized. Customers are never backlogged or promised future delivery. Inventory is held locally at each distribution center, and there is no movement of stock between locations in this archetype. Structure cues: - Time is a discrete sequence of periods defined in the JSON. Decisions about how much to produce or procure and how much to ship to each location are made at the beginning of each period; demand is realized and served within that same period. - Inventory evolves by carrying over what remains from the previous period, adding any new production assigned to the location, and subtracting units that are sold or intentionally discarded as waste. On-hand stock is never allowed to become negative. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Any demand that cannot be met from available local inventory in the period is treated as lost sales and incurs the lost sales penalty. There is no concept of backorders, reservations, or delayed fulfillment. - Production for each product in each period cannot exceed the given production capacity. Production is available without delay in this archetype because lead times are effectively zero. - Storage capacity at each location and period limits the total volume of on-hand inventory using product-specific storage usage coefficients and location capacities from the JSON: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected even in periods where they do not bind. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory. - Labor capacity is set high enough that it does not bind in this archetype, but if labor constraints are included they must be consistent with the JSON parameters. - The objective is to minimize total cost over the horizon, including inventory holding costs, waste costs, and lost sales penalties. No fixed ordering costs, minimum order quantities, lead times, reverse flows, or global budgets are active here. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_base_v2", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4447.5755491154705, "DC2": 2987.5840778008924, "DC3": 3053.895707116281, "DC4": 3109.0834536561856, "DC5": 2396.33602691168}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [316, 341, 356, 411, 415, 593, 780, 888, 1143, 1284, 1406, 1211, 1062, 845, 799, 490, 461, 344, 330, 286], "SKU_Premium": [167, 168, 182, 189, 213, 306, 357, 513, 602, 655, 734, 590, 504, 445, 366, 311, 239, 204, 188, 133], "SKU_ShortLife": [107, 126, 150, 163, 177, 232, 311, 338, 478, 527, 464, 467, 461, 322, 313, 200, 172, 139, 113, 139]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
391,558.5
retail_f1_base_v3
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_base Scenario ID: retail_f1_base_v3 [BUSINESS DESCRIPTION] Business narrative: The retailer manages weekly inventory for several products across multiple distribution centers that directly serve final customer demand. Demand for each product at each location is seasonal and exogenous. Products are replenished each period up to a per-product production or procurement capacity, and any demand that is not served immediately in the period is permanently lost and penalized. Customers are never backlogged or promised future delivery. Inventory is held locally at each distribution center, and there is no movement of stock between locations in this archetype. Structure cues: - Time is a discrete sequence of periods defined in the JSON. Decisions about how much to produce or procure and how much to ship to each location are made at the beginning of each period; demand is realized and served within that same period. - Inventory evolves by carrying over what remains from the previous period, adding any new production assigned to the location, and subtracting units that are sold or intentionally discarded as waste. On-hand stock is never allowed to become negative. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Any demand that cannot be met from available local inventory in the period is treated as lost sales and incurs the lost sales penalty. There is no concept of backorders, reservations, or delayed fulfillment. - Production for each product in each period cannot exceed the given production capacity. Production is available without delay in this archetype because lead times are effectively zero. - Storage capacity at each location and period limits the total volume of on-hand inventory using product-specific storage usage coefficients and location capacities from the JSON: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected even in periods where they do not bind. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory. - Labor capacity is set high enough that it does not bind in this archetype, but if labor constraints are included they must be consistent with the JSON parameters. - The objective is to minimize total cost over the horizon, including inventory holding costs, waste costs, and lost sales penalties. No fixed ordering costs, minimum order quantities, lead times, reverse flows, or global budgets are active here. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_base_v3", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 3562.759788915129, "DC2": 3723.1267692084807, "DC3": 2902.8972961960258, "DC4": 2878.3647165557336, "DC5": 2406.5336318774703}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [333, 319, 364, 412, 411, 488, 707, 770, 953, 1277, 1481, 1181, 1026, 808, 783, 512, 478, 392, 289, 313], "SKU_Premium": [158, 175, 152, 185, 199, 260, 371, 485, 600, 551, 655, 577, 488, 491, 346, 309, 223, 205, 153, 164], "SKU_ShortLife": [128, 113, 113, 125, 185, 218, 278, 356, 427, 567, 468, 450, 419, 311, 318, 206, 169, 133, 124, 121]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
370,433.5
retail_f1_base_v4
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_base Scenario ID: retail_f1_base_v4 [BUSINESS DESCRIPTION] Business narrative: The retailer manages weekly inventory for several products across multiple distribution centers that directly serve final customer demand. Demand for each product at each location is seasonal and exogenous. Products are replenished each period up to a per-product production or procurement capacity, and any demand that is not served immediately in the period is permanently lost and penalized. Customers are never backlogged or promised future delivery. Inventory is held locally at each distribution center, and there is no movement of stock between locations in this archetype. Structure cues: - Time is a discrete sequence of periods defined in the JSON. Decisions about how much to produce or procure and how much to ship to each location are made at the beginning of each period; demand is realized and served within that same period. - Inventory evolves by carrying over what remains from the previous period, adding any new production assigned to the location, and subtracting units that are sold or intentionally discarded as waste. On-hand stock is never allowed to become negative. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Any demand that cannot be met from available local inventory in the period is treated as lost sales and incurs the lost sales penalty. There is no concept of backorders, reservations, or delayed fulfillment. - Production for each product in each period cannot exceed the given production capacity. Production is available without delay in this archetype because lead times are effectively zero. - Storage capacity at each location and period limits the total volume of on-hand inventory using product-specific storage usage coefficients and location capacities from the JSON: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected even in periods where they do not bind. - Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory. Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to. Demand fulfillment equation: - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from] - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to] Interpretation: p_from's demand is served by own sales + substitution + lost. p_to's total sales include serving both its own demand and p_from's demand. - There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory. - Labor capacity is set high enough that it does not bind in this archetype, but if labor constraints are included they must be consistent with the JSON parameters. - The objective is to minimize total cost over the horizon, including inventory holding costs, waste costs, and lost sales penalties. No fixed ordering costs, minimum order quantities, lead times, reverse flows, or global budgets are active here. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_base_v4", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4177.522809726864, "DC2": 3710.855822151861, "DC3": 2808.537929551953, "DC4": 3211.796405026038, "DC5": 2753.1161453167974}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [268, 294, 341, 377, 427, 537, 806, 772, 1120, 1156, 1485, 1316, 997, 859, 663, 505, 408, 364, 356, 302], "SKU_Premium": [171, 135, 182, 204, 210, 236, 361, 402, 632, 536, 590, 619, 529, 452, 323, 295, 229, 166, 146, 162], "SKU_ShortLife": [121, 116, 119, 156, 190, 236, 271, 368, 484, 505, 553, 452, 376, 324, 322, 195, 177, 124, 132, 136]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
371,353
retail_f1_high_waste_v0
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_high_waste Scenario ID: retail_f1_high_waste_v0 [BUSINESS DESCRIPTION] Business narrative: This scenario keeps the same basic single-echelon structure as the core operations baseline but represents categories where waste is extremely expensive, such as highly perishable or sensitive products. The retailer still serves exogenous seasonal demand from local inventories at distribution centers with no transshipment and no backorders. Any units that must be discarded because they are no longer usable incur a much higher penalty than in the baseline, creating strong pressure to avoid overstocking. Structure cues: - The network is the same as in retail_f1_base: multiple products, multiple locations that directly serve final demand, and per-product production capacities in each period. - Inventory is held at each location, evolves from period to period by adding local production and subtracting sales and waste, and is never allowed to go negative. Unserved demand is treated as lost sales and penalized as in the baseline. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - The substitution pattern (Basic's demand served by Premium), absence of transshipment, zero lead times, and effectively non-binding labor capacities are the same as in the baseline scenario. - The only intended structural change is in the cost weights: waste costs in the JSON are much larger, so discarding inventory is heavily discouraged, but the constraint system itself is not altered. - The objective continues to minimize the sum of holding costs, waste costs, and lost sales penalties over all products, locations, and periods. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_high_waste_v0", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4000, "DC2": 3500, "DC3": 3000, "DC4": 3000, "DC5": 2500}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [303, 311, 328, 365, 435, 549, 711, 906, 1100, 1245, 1300, 1245, 1100, 906, 711, 549, 435, 365, 328, 311], "SKU_Premium": [151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622, 550, 453, 355, 274, 217, 182, 164, 155], "SKU_ShortLife": [121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498, 440, 362, 284, 219, 174, 146, 131, 124]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 40.0, "SKU_Premium": 60.0, "SKU_ShortLife": 40.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
378,951.5
retail_f1_high_waste_v1
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_high_waste Scenario ID: retail_f1_high_waste_v1 [BUSINESS DESCRIPTION] Business narrative: This scenario keeps the same basic single-echelon structure as the core operations baseline but represents categories where waste is extremely expensive, such as highly perishable or sensitive products. The retailer still serves exogenous seasonal demand from local inventories at distribution centers with no transshipment and no backorders. Any units that must be discarded because they are no longer usable incur a much higher penalty than in the baseline, creating strong pressure to avoid overstocking. Structure cues: - The network is the same as in retail_f1_base: multiple products, multiple locations that directly serve final demand, and per-product production capacities in each period. - Inventory is held at each location, evolves from period to period by adding local production and subtracting sales and waste, and is never allowed to go negative. Unserved demand is treated as lost sales and penalized as in the baseline. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - The substitution pattern (Basic's demand served by Premium), absence of transshipment, zero lead times, and effectively non-binding labor capacities are the same as in the baseline scenario. - The only intended structural change is in the cost weights: waste costs in the JSON are much larger, so discarding inventory is heavily discouraged, but the constraint system itself is not altered. - The objective continues to minimize the sum of holding costs, waste costs, and lost sales penalties over all products, locations, and periods. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_high_waste_v1", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4374.126676532868, "DC2": 4009.3552443495837, "DC3": 3127.8288463783015, "DC4": 3346.928548537924, "DC5": 2760.3224302412423}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [270, 269, 299, 334, 482, 504, 632, 782, 1058, 1218, 1360, 1352, 1230, 810, 787, 567, 374, 338, 289, 334], "SKU_Premium": [145, 140, 160, 175, 234, 311, 382, 407, 559, 545, 651, 567, 498, 404, 324, 237, 206, 161, 183, 171], "SKU_ShortLife": [107, 135, 134, 154, 178, 220, 246, 367, 485, 429, 556, 499, 405, 403, 265, 217, 197, 163, 135, 112]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 40.0, "SKU_Premium": 60.0, "SKU_ShortLife": 40.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
367,896
retail_f1_high_waste_v2
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_high_waste Scenario ID: retail_f1_high_waste_v2 [BUSINESS DESCRIPTION] Business narrative: This scenario keeps the same basic single-echelon structure as the core operations baseline but represents categories where waste is extremely expensive, such as highly perishable or sensitive products. The retailer still serves exogenous seasonal demand from local inventories at distribution centers with no transshipment and no backorders. Any units that must be discarded because they are no longer usable incur a much higher penalty than in the baseline, creating strong pressure to avoid overstocking. Structure cues: - The network is the same as in retail_f1_base: multiple products, multiple locations that directly serve final demand, and per-product production capacities in each period. - Inventory is held at each location, evolves from period to period by adding local production and subtracting sales and waste, and is never allowed to go negative. Unserved demand is treated as lost sales and penalized as in the baseline. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - The substitution pattern (Basic's demand served by Premium), absence of transshipment, zero lead times, and effectively non-binding labor capacities are the same as in the baseline scenario. - The only intended structural change is in the cost weights: waste costs in the JSON are much larger, so discarding inventory is heavily discouraged, but the constraint system itself is not altered. - The objective continues to minimize the sum of holding costs, waste costs, and lost sales penalties over all products, locations, and periods. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_high_waste_v2", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4239.5437634365735, "DC2": 3281.1772732001004, "DC3": 3309.019640012453, "DC4": 3287.5725035998616, "DC5": 2148.382238669537}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [278, 266, 291, 364, 400, 472, 773, 1023, 1239, 1320, 1122, 1132, 1070, 934, 754, 549, 378, 355, 348, 338], "SKU_Premium": [165, 135, 184, 172, 198, 258, 311, 464, 515, 625, 645, 701, 585, 465, 368, 256, 208, 178, 157, 170], "SKU_ShortLife": [136, 114, 119, 127, 157, 199, 289, 382, 489, 570, 447, 462, 465, 338, 324, 216, 162, 156, 136, 122]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 40.0, "SKU_Premium": 60.0, "SKU_ShortLife": 40.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
379,063
retail_f1_high_waste_v3
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_high_waste Scenario ID: retail_f1_high_waste_v3 [BUSINESS DESCRIPTION] Business narrative: This scenario keeps the same basic single-echelon structure as the core operations baseline but represents categories where waste is extremely expensive, such as highly perishable or sensitive products. The retailer still serves exogenous seasonal demand from local inventories at distribution centers with no transshipment and no backorders. Any units that must be discarded because they are no longer usable incur a much higher penalty than in the baseline, creating strong pressure to avoid overstocking. Structure cues: - The network is the same as in retail_f1_base: multiple products, multiple locations that directly serve final demand, and per-product production capacities in each period. - Inventory is held at each location, evolves from period to period by adding local production and subtracting sales and waste, and is never allowed to go negative. Unserved demand is treated as lost sales and penalized as in the baseline. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - The substitution pattern (Basic's demand served by Premium), absence of transshipment, zero lead times, and effectively non-binding labor capacities are the same as in the baseline scenario. - The only intended structural change is in the cost weights: waste costs in the JSON are much larger, so discarding inventory is heavily discouraged, but the constraint system itself is not altered. - The objective continues to minimize the sum of holding costs, waste costs, and lost sales penalties over all products, locations, and periods. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_high_waste_v3", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4401.3951355135505, "DC2": 3048.001515599564, "DC3": 3055.142380942407, "DC4": 3274.881736277081, "DC5": 2129.7650931970747}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [319, 288, 305, 364, 447, 587, 638, 778, 1105, 1197, 1283, 1219, 1261, 873, 673, 528, 463, 314, 336, 350], "SKU_Premium": [130, 155, 185, 187, 223, 282, 337, 499, 485, 684, 727, 538, 574, 406, 334, 235, 208, 169, 176, 147], "SKU_ShortLife": [121, 135, 114, 132, 172, 222, 322, 388, 455, 453, 518, 546, 483, 371, 301, 207, 194, 139, 133, 126]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 40.0, "SKU_Premium": 60.0, "SKU_ShortLife": 40.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
377,421.5
retail_f1_high_waste_v4
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_high_waste Scenario ID: retail_f1_high_waste_v4 [BUSINESS DESCRIPTION] Business narrative: This scenario keeps the same basic single-echelon structure as the core operations baseline but represents categories where waste is extremely expensive, such as highly perishable or sensitive products. The retailer still serves exogenous seasonal demand from local inventories at distribution centers with no transshipment and no backorders. Any units that must be discarded because they are no longer usable incur a much higher penalty than in the baseline, creating strong pressure to avoid overstocking. Structure cues: - The network is the same as in retail_f1_base: multiple products, multiple locations that directly serve final demand, and per-product production capacities in each period. - Inventory is held at each location, evolves from period to period by adding local production and subtracting sales and waste, and is never allowed to go negative. Unserved demand is treated as lost sales and penalized as in the baseline. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - The substitution pattern (Basic's demand served by Premium), absence of transshipment, zero lead times, and effectively non-binding labor capacities are the same as in the baseline scenario. - The only intended structural change is in the cost weights: waste costs in the JSON are much larger, so discarding inventory is heavily discouraged, but the constraint system itself is not altered. - The objective continues to minimize the sum of holding costs, waste costs, and lost sales penalties over all products, locations, and periods. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_high_waste_v4", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 3430.373920082548, "DC2": 3117.199409297448, "DC3": 3249.5025472470406, "DC4": 3171.7893883100883, "DC5": 2551.077956769335}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [262, 292, 343, 318, 463, 621, 802, 881, 1159, 1300, 1128, 1311, 1145, 1022, 667, 619, 484, 329, 279, 281], "SKU_Premium": [172, 140, 172, 181, 221, 267, 396, 481, 483, 665, 646, 685, 501, 500, 329, 270, 209, 176, 171, 142], "SKU_ShortLife": [109, 126, 143, 134, 192, 241, 257, 332, 438, 474, 467, 491, 503, 397, 265, 220, 150, 165, 116, 141]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 1.0, "SKU_Premium": 1.5, "SKU_ShortLife": 1.0}, "waste": {"SKU_Basic": 40.0, "SKU_Premium": 60.0, "SKU_ShortLife": 40.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
385,802.5
retail_f1_jit_logic_v0
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_jit_logic Scenario ID: retail_f1_jit_logic_v0 [BUSINESS DESCRIPTION] Business narrative: This scenario represents a just-in-time regime where holding inventory is very expensive. The retailer still faces exogenous seasonal demand at each location, cannot backorder customers, and has limited per-product production capacity per period. Because holding costs are high, the retailer is incentivized to keep inventories as lean as possible while still avoiding excessive lost sales. Structure cues: - The physical network and decision timing are the same as in retail_f1_base: single-echelon, multi-product, multi-location, with local demand and local inventory. - Inventory at each location carries over from the previous period, is increased by local production that arrives without delay, and is reduced by sales and any intentional waste. Stock levels must remain non-negative, and any demand in excess of available stock is treated as lost sales. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype. - Holding cost coefficients in the JSON are scaled up substantially compared with retail_f1_base, making on-hand inventory much more expensive relative to lost sales. The underlying constraint structure is unchanged. - The objective is to minimize total cost including holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_jit_logic_v0", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4000, "DC2": 3500, "DC3": 3000, "DC4": 3000, "DC5": 2500}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [303, 311, 328, 365, 435, 549, 711, 906, 1100, 1245, 1300, 1245, 1100, 906, 711, 549, 435, 365, 328, 311], "SKU_Premium": [151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622, 550, 453, 355, 274, 217, 182, 164, 155], "SKU_ShortLife": [121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498, 440, 362, 284, 219, 174, 146, 131, 124]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 20.0, "SKU_Premium": 30.0, "SKU_ShortLife": 20.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
502,325
retail_f1_jit_logic_v1
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_jit_logic Scenario ID: retail_f1_jit_logic_v1 [BUSINESS DESCRIPTION] Business narrative: This scenario represents a just-in-time regime where holding inventory is very expensive. The retailer still faces exogenous seasonal demand at each location, cannot backorder customers, and has limited per-product production capacity per period. Because holding costs are high, the retailer is incentivized to keep inventories as lean as possible while still avoiding excessive lost sales. Structure cues: - The physical network and decision timing are the same as in retail_f1_base: single-echelon, multi-product, multi-location, with local demand and local inventory. - Inventory at each location carries over from the previous period, is increased by local production that arrives without delay, and is reduced by sales and any intentional waste. Stock levels must remain non-negative, and any demand in excess of available stock is treated as lost sales. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype. - Holding cost coefficients in the JSON are scaled up substantially compared with retail_f1_base, making on-hand inventory much more expensive relative to lost sales. The underlying constraint structure is unchanged. - The objective is to minimize total cost including holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_jit_logic_v1", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4227.503985981191, "DC2": 3175.2200216676033, "DC3": 2994.148110462189, "DC4": 3096.259483977715, "DC5": 2402.735217991342}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [309, 303, 337, 340, 452, 609, 663, 844, 1155, 1285, 1418, 1103, 1209, 843, 806, 541, 375, 330, 357, 321], "SKU_Premium": [165, 151, 157, 154, 209, 280, 385, 478, 620, 635, 609, 667, 566, 451, 357, 266, 204, 188, 146, 169], "SKU_ShortLife": [104, 132, 122, 155, 162, 226, 288, 334, 421, 514, 527, 527, 434, 326, 251, 232, 151, 130, 114, 122]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 20.0, "SKU_Premium": 30.0, "SKU_ShortLife": 20.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
516,420
retail_f1_jit_logic_v2
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_jit_logic Scenario ID: retail_f1_jit_logic_v2 [BUSINESS DESCRIPTION] Business narrative: This scenario represents a just-in-time regime where holding inventory is very expensive. The retailer still faces exogenous seasonal demand at each location, cannot backorder customers, and has limited per-product production capacity per period. Because holding costs are high, the retailer is incentivized to keep inventories as lean as possible while still avoiding excessive lost sales. Structure cues: - The physical network and decision timing are the same as in retail_f1_base: single-echelon, multi-product, multi-location, with local demand and local inventory. - Inventory at each location carries over from the previous period, is increased by local production that arrives without delay, and is reduced by sales and any intentional waste. Stock levels must remain non-negative, and any demand in excess of available stock is treated as lost sales. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype. - Holding cost coefficients in the JSON are scaled up substantially compared with retail_f1_base, making on-hand inventory much more expensive relative to lost sales. The underlying constraint structure is unchanged. - The objective is to minimize total cost including holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_jit_logic_v2", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4452.650038535987, "DC2": 3413.3710389191046, "DC3": 2793.7486082944533, "DC4": 2591.9222764205074, "DC5": 2357.3241337705263}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [257, 319, 344, 411, 494, 519, 750, 871, 1258, 1264, 1196, 1414, 1086, 927, 638, 584, 419, 392, 323, 350], "SKU_Premium": [171, 137, 187, 206, 247, 247, 376, 386, 471, 639, 647, 604, 615, 474, 329, 293, 199, 175, 174, 147], "SKU_ShortLife": [136, 128, 119, 161, 173, 193, 251, 393, 442, 527, 542, 453, 435, 385, 250, 219, 153, 163, 122, 110]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 20.0, "SKU_Premium": 30.0, "SKU_ShortLife": 20.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
512,565
retail_f1_jit_logic_v3
[SCENARIO] Family: F1 (Core Operations) Archetype: retail_f1_jit_logic Scenario ID: retail_f1_jit_logic_v3 [BUSINESS DESCRIPTION] Business narrative: This scenario represents a just-in-time regime where holding inventory is very expensive. The retailer still faces exogenous seasonal demand at each location, cannot backorder customers, and has limited per-product production capacity per period. Because holding costs are high, the retailer is incentivized to keep inventories as lean as possible while still avoiding excessive lost sales. Structure cues: - The physical network and decision timing are the same as in retail_f1_base: single-echelon, multi-product, multi-location, with local demand and local inventory. - Inventory at each location carries over from the previous period, is increased by local production that arrives without delay, and is reduced by sales and any intentional waste. Stock levels must remain non-negative, and any demand in excess of available stock is treated as lost sales. - Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE. VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining. Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST. KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms: (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l] - This is ONLY the inflow from production. Do NOT subtract sales here! - Q is total production, demand_share distributes it to locations. (2) Aging: I[p,l,t+1,r] = I[p,l,t,r+1] - sales[p,l,t,r+1] for r=1..SL-1 - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1] - Items with r=1 that aren't sold become waste (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r] - Can only sell what you have in inventory (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2 - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) - Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected. - Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype. - Holding cost coefficients in the JSON are scaled up substantially compared with retail_f1_base, making on-hand inventory much more expensive relative to lost sales. The underlying constraint structure is unchanged. - The objective is to minimize total cost including holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation. [DATA SCHEMA] { "name": str, # scenario identifier "periods": int, # number of time periods "products": [str, ...], # list of product IDs "locations": [str, ...], # list of location IDs "shelf_life": {p: int}, # shelf life in periods per product "lead_time": {p: int}, # order lead time per product (0 = same-period arrival) "demand_curve": {p: [float, ...]}, # demand per product per period (0-indexed list) "demand_share": {l: float}, # fraction of total demand at each location "production_cap": {p: [float, ...]}, # max production per product per period (0-indexed list) "cold_capacity": {l: float}, # storage capacity per location "cold_usage": {p: float}, # storage units per unit of product "labor_cap": {l: [float, ...]}, # labor hours per location per period (0-indexed list) "labor_usage": {p: float}, # labor hours per unit sold "return_rate": {p: float}, # fraction of sales returned next period "costs": { "purchasing": {p: float}, # cost per unit ordered "inventory": {p: float}, # holding cost per unit per period "waste": {p: float}, # cost per unit expired "lost_sales": {p: float}, # penalty per unit of unmet demand "fixed_order": float, # fixed cost per order placed "transshipment": float # cost per unit transshipped }, "constraints": { "moq": float, # minimum order quantity (0 = no MOQ) "pack_size": int, # order must be multiple of this (1 = no constraint) "budget_per_period": float|null, # max purchasing cost per period "waste_limit_pct": float|null # max waste as fraction of total demand }, "network": { "sub_edges": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to "trans_edges": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to } } [DATA ACCESS] - The variable `data` is pre-loaded. Do NOT use file I/O. - Lists are 0-indexed (period t in model uses index [t-1] in data arrays) CRITICAL - Network edges require tuple conversion for Gurobi: sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])] trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])] [OUTPUT FORMAT] - Import: import gurobipy as gp; from gurobipy import GRB - Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0 - Print at end: print(f"status: {{m.Status}}") if m.Status == 2: print(f"objective: {{m.ObjVal}}") - Output ONLY executable Python code. No markdown, no explanations. [TASK] Write a GurobiPy script that models and solves this optimization problem.
{"name": "retail_f1_jit_logic_v3", "description": "Standard seasonal retail scenario.", "periods": 20, "products": ["SKU_Basic", "SKU_Premium", "SKU_ShortLife"], "locations": ["DC1", "DC2", "DC3", "DC4", "DC5"], "shelf_life": {"SKU_Basic": 10, "SKU_Premium": 8, "SKU_ShortLife": 4}, "lead_time": {"SKU_Basic": 0, "SKU_Premium": 0, "SKU_ShortLife": 0}, "cold_capacity": {"DC1": 4555.306381840641, "DC2": 3422.9891952366816, "DC3": 3109.676300553904, "DC4": 2978.9533068169394, "DC5": 2419.4473267149483}, "cold_usage": {"SKU_Basic": 1.0, "SKU_Premium": 3.0, "SKU_ShortLife": 1.2}, "production_cap": {"SKU_Basic": [800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], "SKU_Premium": [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], "SKU_ShortLife": [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]}, "labor_cap": {"DC1": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC2": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC3": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC4": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], "DC5": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0]}, "labor_usage": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "return_rate": {"SKU_Basic": 0.0, "SKU_Premium": 0.0, "SKU_ShortLife": 0.0}, "demand_curve": {"SKU_Basic": [344, 349, 329, 376, 437, 599, 604, 928, 959, 1064, 1163, 1146, 936, 781, 660, 601, 444, 356, 359, 316], "SKU_Premium": [141, 159, 148, 185, 196, 243, 337, 512, 594, 708, 617, 697, 615, 407, 305, 270, 214, 156, 164, 156], "SKU_ShortLife": [115, 110, 140, 147, 196, 239, 250, 348, 415, 531, 550, 536, 454, 310, 271, 249, 173, 153, 115, 125]}, "demand_share": {"DC1": 0.25, "DC2": 0.2, "DC3": 0.2, "DC4": 0.2, "DC5": 0.15}, "costs": {"lost_sales": {"SKU_Basic": 50.0, "SKU_Premium": 80.0, "SKU_ShortLife": 40.0}, "inventory": {"SKU_Basic": 20.0, "SKU_Premium": 30.0, "SKU_ShortLife": 20.0}, "waste": {"SKU_Basic": 2.0, "SKU_Premium": 3.0, "SKU_ShortLife": 2.0}, "fixed_order": 0.0, "transshipment": 0.5, "purchasing": {"SKU_Basic": 10.0, "SKU_Premium": 20.0, "SKU_ShortLife": 15.0}}, "constraints": {"moq": 0, "pack_size": 1, "budget_per_period": null, "waste_limit_pct": null}, "network": {"sub_edges": [["SKU_Basic", "SKU_Premium"]], "trans_edges": []}}
OPTIMAL
480,555
End of preview. Expand in Data Studio

RetailOpt-190: A Retail Supply Chain Benchmark for Text-to-Optimization

RetailOpt-190 is a solver-validated benchmark for evaluating semantic reliability in text-to-optimization. It tests whether LLM-based agents can reconstruct the intended optimization structure—not just produce runnable code.

Dataset Summary

RetailOpt-190 contains 190 retail supply chain optimization instances designed to test compositional consistency in LLM-generated optimization code. Each instance includes a natural-language problem description, structured JSON data, and ground truth solutions from a validated MILP solver.

The benchmark spans 8 scenario families and 38 archetypes covering core retail planning mechanisms:

Family Name Archetypes Key Mechanisms
F1 Core Operations 4 Multi-period inventory, seasonal demand, perishability
F2 Assortment & Substitution 6 Product substitution, promotions, ultra-short shelf life
F3 Resource Constraints 4 Storage bottleneck, supply bottleneck, volumetric limits
F4 Demand Dynamics 6 Demand surge, supply risk, peak failure
F5 Feasibility Stress 4 Impossible demand, storage overflow, strict service traps
F6 Discrete Logistics 4 Lead time, MOQ, pack size, fixed order cost
F7 Network & Multi-Echelon 6 Transshipment, hub-spoke, multi-sourcing
F8 Omni-channel 4 Reverse logistics, labor constraints, sustainability

Languages

English

Dataset Structure

Data Fields

Field Type Description
scenario_id string Unique scenario identifier (e.g., retail_f1_base_v0)
prompt string Natural-language problem description with structure cues
data string JSON-formatted instance data (parse with json.loads())
reference_status string Ground truth solver status (OPTIMAL, INFEASIBLE, etc.)
reference_objective float Ground truth objective value (null if infeasible)

Data Splits

Split Examples
test 190

Usage

Loading the Dataset

from datasets import load_dataset
import json

# Load dataset
dataset = load_dataset("Jacoblian/RetailOpt-190", split="test")

# Access a sample
sample = dataset[0]
print(sample['scenario_id'])  # e.g., "retail_f1_base_v0"
print(sample['prompt'][:200])  # First 200 chars of prompt

# Parse JSON data
data = json.loads(sample['data'])
print(data['periods'])  # Number of time periods
print(data['products'])  # List of products

Benchmarking Your Model

from datasets import load_dataset
import json

dataset = load_dataset("Jacoblian/RetailOpt-190", split="test")

for sample in dataset:
    # Get prompt and data
    prompt = sample['prompt']
    data = json.loads(sample['data'])

    # Generate code with your LLM
    generated_code = your_llm(prompt)

    # Execute generated code
    exec(generated_code, {'data': data})

    # Compare with ground truth
    print(f"Reference: {sample['reference_status']}, {sample['reference_objective']}")

Evaluation Metrics

  • Execution Rate: Percentage of instances that run without error
  • Accuracy: Percentage matching ground truth (status + objective within tolerance)
  • Silent Failure Rate: Executable code with incorrect answer

Accuracy Tolerances

Family Problem Type Tolerance
F1-F5, F7-F8 LP / easy MIP 0.01%
F6 Hard MIP (MOQ, pack-size) 10%

Dataset Creation

Source Data

All instances are synthetically generated from 38 archetype specifications. Each archetype is instantiated with 5 numerical variants (v0-v4) via controlled parameter perturbations.

Annotations

Ground truth solutions are computed using a validated MILP solver (Gurobi) with the following settings:

  • TimeLimit: 60 seconds
  • MIPGap: 1%
  • Threads: 1

Additional Information

Citation

@article{lian2026reloop,
  author    = {Junbo Jacob Lian and Yujun Sun and Huiling Chen and Chaoyu Zhang and Chung-Piaw Teo},
  title     = {ReLoop: Detecting Silent Failures in LLM-Generated Optimization Code via Behavioral Verification},
  journal   = {arXiv preprint},
  year      = {2026}
}

License

  • Code: MIT
  • Data: CC BY 4.0

Related Resources

Downloads last month
18