{"scenario_id": "retail_f1_52_weeks_v0", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_52_weeks_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 52,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311,\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311,\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155,\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155,\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124,\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124,\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1006432.0} {"scenario_id": "retail_f1_52_weeks_v1", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_52_weeks_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 52,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3483.5107111415105,\n \"DC2\": 3583.3567701844527,\n \"DC3\": 2823.773247022257,\n \"DC4\": 2587.2574205432406,\n \"DC5\": 2324.632357495927\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 289,\n 294,\n 338,\n 348,\n 445,\n 626,\n 729,\n 911,\n 1247,\n 1288,\n 1207,\n 1213,\n 1097,\n 889,\n 808,\n 617,\n 437,\n 408,\n 337,\n 286,\n 338,\n 272,\n 359,\n 320,\n 414,\n 515,\n 628,\n 935,\n 1045,\n 1377,\n 1398,\n 1128,\n 997,\n 865,\n 774,\n 628,\n 426,\n 350,\n 324,\n 274,\n 301,\n 298,\n 359,\n 358,\n 427,\n 495,\n 773,\n 1008,\n 1188,\n 1400,\n 1407,\n 1321\n ],\n \"SKU_Premium\": [\n 156,\n 132,\n 170,\n 180,\n 199,\n 301,\n 357,\n 470,\n 487,\n 563,\n 735,\n 569,\n 508,\n 391,\n 321,\n 259,\n 206,\n 181,\n 186,\n 176,\n 140,\n 159,\n 181,\n 205,\n 245,\n 276,\n 384,\n 459,\n 526,\n 691,\n 612,\n 572,\n 579,\n 421,\n 336,\n 278,\n 245,\n 183,\n 144,\n 161,\n 132,\n 150,\n 172,\n 157,\n 231,\n 301,\n 321,\n 456,\n 497,\n 682,\n 621,\n 626\n ],\n \"SKU_ShortLife\": [\n 114,\n 126,\n 122,\n 166,\n 193,\n 224,\n 262,\n 328,\n 458,\n 430,\n 475,\n 446,\n 419,\n 314,\n 309,\n 201,\n 152,\n 163,\n 142,\n 140,\n 124,\n 112,\n 113,\n 161,\n 169,\n 188,\n 252,\n 359,\n 486,\n 523,\n 580,\n 543,\n 409,\n 335,\n 249,\n 226,\n 151,\n 148,\n 147,\n 126,\n 119,\n 140,\n 136,\n 151,\n 170,\n 188,\n 315,\n 334,\n 402,\n 431,\n 469,\n 466\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1004271.5} {"scenario_id": "retail_f1_52_weeks_v2", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_52_weeks_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 52,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4291.310835751933,\n \"DC2\": 3586.8980554014483,\n \"DC3\": 2802.1254967501045,\n \"DC4\": 2560.502105140458,\n \"DC5\": 2521.5221885622987\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 331,\n 304,\n 318,\n 378,\n 411,\n 628,\n 792,\n 880,\n 1028,\n 1292,\n 1186,\n 1166,\n 1258,\n 808,\n 713,\n 621,\n 394,\n 343,\n 361,\n 348,\n 311,\n 345,\n 356,\n 403,\n 410,\n 611,\n 659,\n 983,\n 1013,\n 1172,\n 1257,\n 1291,\n 1053,\n 976,\n 737,\n 536,\n 435,\n 339,\n 306,\n 322,\n 303,\n 315,\n 335,\n 326,\n 458,\n 575,\n 717,\n 955,\n 1047,\n 1179,\n 1112,\n 1071\n ],\n \"SKU_Premium\": [\n 150,\n 172,\n 159,\n 162,\n 227,\n 279,\n 397,\n 400,\n 615,\n 691,\n 722,\n 707,\n 614,\n 473,\n 395,\n 261,\n 195,\n 181,\n 182,\n 168,\n 131,\n 174,\n 163,\n 182,\n 249,\n 308,\n 320,\n 514,\n 526,\n 645,\n 679,\n 673,\n 563,\n 435,\n 335,\n 279,\n 228,\n 192,\n 144,\n 149,\n 138,\n 152,\n 164,\n 167,\n 238,\n 301,\n 354,\n 456,\n 611,\n 643,\n 612,\n 601\n ],\n \"SKU_ShortLife\": [\n 138,\n 134,\n 146,\n 167,\n 154,\n 221,\n 249,\n 408,\n 460,\n 445,\n 532,\n 513,\n 453,\n 398,\n 303,\n 243,\n 199,\n 124,\n 121,\n 128,\n 127,\n 135,\n 122,\n 134,\n 158,\n 189,\n 272,\n 324,\n 408,\n 439,\n 540,\n 508,\n 471,\n 357,\n 308,\n 187,\n 173,\n 156,\n 129,\n 142,\n 137,\n 140,\n 116,\n 159,\n 175,\n 235,\n 256,\n 402,\n 492,\n 519,\n 455,\n 518\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1026462.5} {"scenario_id": "retail_f1_52_weeks_v3", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_52_weeks_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 52,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4580.392163478575,\n \"DC2\": 3714.3315490990617,\n \"DC3\": 3353.9465124536155,\n \"DC4\": 2764.352652808441,\n \"DC5\": 2583.456876146125\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 345,\n 287,\n 324,\n 310,\n 481,\n 539,\n 778,\n 883,\n 1037,\n 1367,\n 1242,\n 1250,\n 1135,\n 1025,\n 753,\n 498,\n 477,\n 357,\n 349,\n 298,\n 308,\n 320,\n 299,\n 376,\n 475,\n 485,\n 776,\n 846,\n 1026,\n 1409,\n 1114,\n 1198,\n 1256,\n 958,\n 709,\n 523,\n 465,\n 415,\n 374,\n 272,\n 283,\n 295,\n 375,\n 350,\n 500,\n 532,\n 605,\n 966,\n 1177,\n 1308,\n 1141,\n 1165\n ],\n \"SKU_Premium\": [\n 166,\n 144,\n 176,\n 208,\n 221,\n 312,\n 379,\n 416,\n 511,\n 604,\n 638,\n 667,\n 599,\n 488,\n 358,\n 312,\n 238,\n 190,\n 143,\n 155,\n 162,\n 158,\n 146,\n 168,\n 205,\n 311,\n 385,\n 455,\n 608,\n 600,\n 605,\n 606,\n 525,\n 386,\n 407,\n 279,\n 224,\n 165,\n 156,\n 147,\n 169,\n 150,\n 159,\n 197,\n 226,\n 242,\n 326,\n 435,\n 603,\n 607,\n 561,\n 544\n ],\n \"SKU_ShortLife\": [\n 121,\n 115,\n 145,\n 156,\n 148,\n 232,\n 311,\n 390,\n 394,\n 511,\n 448,\n 437,\n 499,\n 358,\n 272,\n 240,\n 180,\n 167,\n 122,\n 125,\n 106,\n 126,\n 111,\n 138,\n 190,\n 186,\n 312,\n 408,\n 404,\n 539,\n 458,\n 540,\n 475,\n 314,\n 316,\n 218,\n 158,\n 141,\n 119,\n 125,\n 115,\n 126,\n 142,\n 143,\n 179,\n 223,\n 306,\n 414,\n 483,\n 496,\n 443,\n 427\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1006574.5} {"scenario_id": "retail_f1_52_weeks_v4", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_52_weeks\nScenario ID: retail_f1_52_weeks_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n\n- No transshipment and zero lead times in this scenario.\n- Labor capacity remains high enough that it does not materially bind, though it can be represented consistently with the JSON.\n- The objective is to minimize total cost over the entire year, aggregating purchasing, holding, waste, and lost sales costs across all weeks.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_52_weeks_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 52,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3499.737385701882,\n \"DC2\": 3365.874638487682,\n \"DC3\": 2875.5852152529897,\n \"DC4\": 3022.249693724108,\n \"DC5\": 2610.05013090868\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 285,\n 270,\n 313,\n 317,\n 383,\n 529,\n 772,\n 913,\n 1046,\n 1281,\n 1329,\n 1234,\n 1081,\n 866,\n 801,\n 582,\n 487,\n 395,\n 362,\n 315,\n 301,\n 306,\n 368,\n 369,\n 458,\n 501,\n 808,\n 849,\n 1120,\n 1315,\n 1419,\n 1307,\n 1156,\n 903,\n 647,\n 484,\n 408,\n 336,\n 320,\n 278,\n 284,\n 337,\n 298,\n 382,\n 399,\n 581,\n 709,\n 918,\n 1023,\n 1127,\n 1342,\n 1281\n ],\n \"SKU_Premium\": [\n 158,\n 149,\n 150,\n 179,\n 201,\n 289,\n 334,\n 448,\n 525,\n 641,\n 715,\n 641,\n 523,\n 472,\n 329,\n 238,\n 236,\n 178,\n 184,\n 136,\n 155,\n 169,\n 177,\n 157,\n 186,\n 295,\n 342,\n 415,\n 555,\n 528,\n 726,\n 711,\n 485,\n 393,\n 373,\n 283,\n 230,\n 176,\n 180,\n 155,\n 168,\n 132,\n 155,\n 156,\n 212,\n 277,\n 388,\n 476,\n 485,\n 611,\n 737,\n 572\n ],\n \"SKU_ShortLife\": [\n 130,\n 137,\n 133,\n 144,\n 156,\n 234,\n 274,\n 396,\n 449,\n 467,\n 480,\n 508,\n 409,\n 373,\n 295,\n 226,\n 152,\n 135,\n 120,\n 118,\n 137,\n 106,\n 147,\n 149,\n 171,\n 241,\n 248,\n 329,\n 450,\n 437,\n 548,\n 572,\n 397,\n 404,\n 255,\n 226,\n 178,\n 144,\n 122,\n 136,\n 126,\n 120,\n 148,\n 127,\n 162,\n 207,\n 247,\n 337,\n 496,\n 436,\n 568,\n 548\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1006442.5} {"scenario_id": "retail_f1_base_v0", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_base_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f1_base_v1", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_base_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3533.9579113297223,\n \"DC2\": 3317.622259031674,\n \"DC3\": 2662.2471240015657,\n \"DC4\": 2571.1157376641754,\n \"DC5\": 2208.3235255734785\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 258,\n 307,\n 329,\n 349,\n 465,\n 513,\n 673,\n 868,\n 1079,\n 1397,\n 1353,\n 1185,\n 945,\n 825,\n 787,\n 516,\n 420,\n 330,\n 329,\n 307\n ],\n \"SKU_Premium\": [\n 150,\n 151,\n 166,\n 207,\n 245,\n 312,\n 372,\n 392,\n 582,\n 679,\n 639,\n 681,\n 559,\n 387,\n 338,\n 302,\n 191,\n 198,\n 179,\n 165\n ],\n \"SKU_ShortLife\": [\n 131,\n 120,\n 144,\n 164,\n 175,\n 218,\n 293,\n 361,\n 396,\n 444,\n 569,\n 492,\n 422,\n 386,\n 323,\n 249,\n 192,\n 157,\n 137,\n 136\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 379803.0} {"scenario_id": "retail_f1_base_v2", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_base_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4447.5755491154705,\n \"DC2\": 2987.5840778008924,\n \"DC3\": 3053.895707116281,\n \"DC4\": 3109.0834536561856,\n \"DC5\": 2396.33602691168\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 316,\n 341,\n 356,\n 411,\n 415,\n 593,\n 780,\n 888,\n 1143,\n 1284,\n 1406,\n 1211,\n 1062,\n 845,\n 799,\n 490,\n 461,\n 344,\n 330,\n 286\n ],\n \"SKU_Premium\": [\n 167,\n 168,\n 182,\n 189,\n 213,\n 306,\n 357,\n 513,\n 602,\n 655,\n 734,\n 590,\n 504,\n 445,\n 366,\n 311,\n 239,\n 204,\n 188,\n 133\n ],\n \"SKU_ShortLife\": [\n 107,\n 126,\n 150,\n 163,\n 177,\n 232,\n 311,\n 338,\n 478,\n 527,\n 464,\n 467,\n 461,\n 322,\n 313,\n 200,\n 172,\n 139,\n 113,\n 139\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 391558.5} {"scenario_id": "retail_f1_base_v3", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_base_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3562.759788915129,\n \"DC2\": 3723.1267692084807,\n \"DC3\": 2902.8972961960258,\n \"DC4\": 2878.3647165557336,\n \"DC5\": 2406.5336318774703\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 333,\n 319,\n 364,\n 412,\n 411,\n 488,\n 707,\n 770,\n 953,\n 1277,\n 1481,\n 1181,\n 1026,\n 808,\n 783,\n 512,\n 478,\n 392,\n 289,\n 313\n ],\n \"SKU_Premium\": [\n 158,\n 175,\n 152,\n 185,\n 199,\n 260,\n 371,\n 485,\n 600,\n 551,\n 655,\n 577,\n 488,\n 491,\n 346,\n 309,\n 223,\n 205,\n 153,\n 164\n ],\n \"SKU_ShortLife\": [\n 128,\n 113,\n 113,\n 125,\n 185,\n 218,\n 278,\n 356,\n 427,\n 567,\n 468,\n 450,\n 419,\n 311,\n 318,\n 206,\n 169,\n 133,\n 124,\n 121\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 370433.5} {"scenario_id": "retail_f1_base_v4", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_base\nScenario ID: retail_f1_base_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n\n- 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.\n- 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.\n- 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.\n- Substitution: Edge [p_from, p_to] means p_from's demand can be served by p_to's inventory.\n Variable sub[p_from, p_to, l, t] = units of p_from's demand fulfilled by p_to.\n\n Demand fulfillment equation:\n - For p_from: total_sales[p_from] + sub[p_from, p_to] + L[p_from] = demand[p_from]\n - For p_to: total_sales[p_to] - sub[p_from, p_to] + L[p_to] = demand[p_to]\n\n Interpretation: p_from's demand is served by own sales + substitution + lost.\n p_to's total sales include serving both its own demand and p_from's demand.\n- There is no transshipment of inventory between locations; each location can only serve its own local demand from its own inventory.\n- 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.\n- The objective is to minimize total cost over the horizon, including purchasing costs, 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.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_base_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4177.522809726864,\n \"DC2\": 3710.855822151861,\n \"DC3\": 2808.537929551953,\n \"DC4\": 3211.796405026038,\n \"DC5\": 2753.1161453167974\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 268,\n 294,\n 341,\n 377,\n 427,\n 537,\n 806,\n 772,\n 1120,\n 1156,\n 1485,\n 1316,\n 997,\n 859,\n 663,\n 505,\n 408,\n 364,\n 356,\n 302\n ],\n \"SKU_Premium\": [\n 171,\n 135,\n 182,\n 204,\n 210,\n 236,\n 361,\n 402,\n 632,\n 536,\n 590,\n 619,\n 529,\n 452,\n 323,\n 295,\n 229,\n 166,\n 146,\n 162\n ],\n \"SKU_ShortLife\": [\n 121,\n 116,\n 119,\n 156,\n 190,\n 236,\n 271,\n 368,\n 484,\n 505,\n 553,\n 452,\n 376,\n 324,\n 322,\n 195,\n 177,\n 124,\n 132,\n 136\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 371353.0} {"scenario_id": "retail_f1_high_waste_v0", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_high_waste_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 40.0,\n \"SKU_Premium\": 60.0,\n \"SKU_ShortLife\": 40.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f1_high_waste_v1", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_high_waste_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4374.126676532868,\n \"DC2\": 4009.3552443495837,\n \"DC3\": 3127.8288463783015,\n \"DC4\": 3346.928548537924,\n \"DC5\": 2760.3224302412423\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 270,\n 269,\n 299,\n 334,\n 482,\n 504,\n 632,\n 782,\n 1058,\n 1218,\n 1360,\n 1352,\n 1230,\n 810,\n 787,\n 567,\n 374,\n 338,\n 289,\n 334\n ],\n \"SKU_Premium\": [\n 145,\n 140,\n 160,\n 175,\n 234,\n 311,\n 382,\n 407,\n 559,\n 545,\n 651,\n 567,\n 498,\n 404,\n 324,\n 237,\n 206,\n 161,\n 183,\n 171\n ],\n \"SKU_ShortLife\": [\n 107,\n 135,\n 134,\n 154,\n 178,\n 220,\n 246,\n 367,\n 485,\n 429,\n 556,\n 499,\n 405,\n 403,\n 265,\n 217,\n 197,\n 163,\n 135,\n 112\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 40.0,\n \"SKU_Premium\": 60.0,\n \"SKU_ShortLife\": 40.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 367896.0} {"scenario_id": "retail_f1_high_waste_v2", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_high_waste_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4239.5437634365735,\n \"DC2\": 3281.1772732001004,\n \"DC3\": 3309.019640012453,\n \"DC4\": 3287.5725035998616,\n \"DC5\": 2148.382238669537\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 278,\n 266,\n 291,\n 364,\n 400,\n 472,\n 773,\n 1023,\n 1239,\n 1320,\n 1122,\n 1132,\n 1070,\n 934,\n 754,\n 549,\n 378,\n 355,\n 348,\n 338\n ],\n \"SKU_Premium\": [\n 165,\n 135,\n 184,\n 172,\n 198,\n 258,\n 311,\n 464,\n 515,\n 625,\n 645,\n 701,\n 585,\n 465,\n 368,\n 256,\n 208,\n 178,\n 157,\n 170\n ],\n \"SKU_ShortLife\": [\n 136,\n 114,\n 119,\n 127,\n 157,\n 199,\n 289,\n 382,\n 489,\n 570,\n 447,\n 462,\n 465,\n 338,\n 324,\n 216,\n 162,\n 156,\n 136,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 40.0,\n \"SKU_Premium\": 60.0,\n \"SKU_ShortLife\": 40.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 379063.0} {"scenario_id": "retail_f1_high_waste_v3", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_high_waste_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4401.3951355135505,\n \"DC2\": 3048.001515599564,\n \"DC3\": 3055.142380942407,\n \"DC4\": 3274.881736277081,\n \"DC5\": 2129.7650931970747\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 319,\n 288,\n 305,\n 364,\n 447,\n 587,\n 638,\n 778,\n 1105,\n 1197,\n 1283,\n 1219,\n 1261,\n 873,\n 673,\n 528,\n 463,\n 314,\n 336,\n 350\n ],\n \"SKU_Premium\": [\n 130,\n 155,\n 185,\n 187,\n 223,\n 282,\n 337,\n 499,\n 485,\n 684,\n 727,\n 538,\n 574,\n 406,\n 334,\n 235,\n 208,\n 169,\n 176,\n 147\n ],\n \"SKU_ShortLife\": [\n 121,\n 135,\n 114,\n 132,\n 172,\n 222,\n 322,\n 388,\n 455,\n 453,\n 518,\n 546,\n 483,\n 371,\n 301,\n 207,\n 194,\n 139,\n 133,\n 126\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 40.0,\n \"SKU_Premium\": 60.0,\n \"SKU_ShortLife\": 40.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 377421.5} {"scenario_id": "retail_f1_high_waste_v4", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_high_waste\nScenario ID: retail_f1_high_waste_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- 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.\n- 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.\n- The objective continues to minimize the sum of purchasing costs, holding costs, waste costs, and lost sales penalties over all products, locations, and periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_high_waste_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3430.373920082548,\n \"DC2\": 3117.199409297448,\n \"DC3\": 3249.5025472470406,\n \"DC4\": 3171.7893883100883,\n \"DC5\": 2551.077956769335\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 262,\n 292,\n 343,\n 318,\n 463,\n 621,\n 802,\n 881,\n 1159,\n 1300,\n 1128,\n 1311,\n 1145,\n 1022,\n 667,\n 619,\n 484,\n 329,\n 279,\n 281\n ],\n \"SKU_Premium\": [\n 172,\n 140,\n 172,\n 181,\n 221,\n 267,\n 396,\n 481,\n 483,\n 665,\n 646,\n 685,\n 501,\n 500,\n 329,\n 270,\n 209,\n 176,\n 171,\n 142\n ],\n \"SKU_ShortLife\": [\n 109,\n 126,\n 143,\n 134,\n 192,\n 241,\n 257,\n 332,\n 438,\n 474,\n 467,\n 491,\n 503,\n 397,\n 265,\n 220,\n 150,\n 165,\n 116,\n 141\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 40.0,\n \"SKU_Premium\": 60.0,\n \"SKU_ShortLife\": 40.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 385802.5} {"scenario_id": "retail_f1_jit_logic_v0", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_jit_logic_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 20.0,\n \"SKU_Premium\": 30.0,\n \"SKU_ShortLife\": 20.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 502325.0} {"scenario_id": "retail_f1_jit_logic_v1", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_jit_logic_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4227.503985981191,\n \"DC2\": 3175.2200216676033,\n \"DC3\": 2994.148110462189,\n \"DC4\": 3096.259483977715,\n \"DC5\": 2402.735217991342\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 309,\n 303,\n 337,\n 340,\n 452,\n 609,\n 663,\n 844,\n 1155,\n 1285,\n 1418,\n 1103,\n 1209,\n 843,\n 806,\n 541,\n 375,\n 330,\n 357,\n 321\n ],\n \"SKU_Premium\": [\n 165,\n 151,\n 157,\n 154,\n 209,\n 280,\n 385,\n 478,\n 620,\n 635,\n 609,\n 667,\n 566,\n 451,\n 357,\n 266,\n 204,\n 188,\n 146,\n 169\n ],\n \"SKU_ShortLife\": [\n 104,\n 132,\n 122,\n 155,\n 162,\n 226,\n 288,\n 334,\n 421,\n 514,\n 527,\n 527,\n 434,\n 326,\n 251,\n 232,\n 151,\n 130,\n 114,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 20.0,\n \"SKU_Premium\": 30.0,\n \"SKU_ShortLife\": 20.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 516420.0} {"scenario_id": "retail_f1_jit_logic_v2", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_jit_logic_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4452.650038535987,\n \"DC2\": 3413.3710389191046,\n \"DC3\": 2793.7486082944533,\n \"DC4\": 2591.9222764205074,\n \"DC5\": 2357.3241337705263\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 257,\n 319,\n 344,\n 411,\n 494,\n 519,\n 750,\n 871,\n 1258,\n 1264,\n 1196,\n 1414,\n 1086,\n 927,\n 638,\n 584,\n 419,\n 392,\n 323,\n 350\n ],\n \"SKU_Premium\": [\n 171,\n 137,\n 187,\n 206,\n 247,\n 247,\n 376,\n 386,\n 471,\n 639,\n 647,\n 604,\n 615,\n 474,\n 329,\n 293,\n 199,\n 175,\n 174,\n 147\n ],\n \"SKU_ShortLife\": [\n 136,\n 128,\n 119,\n 161,\n 173,\n 193,\n 251,\n 393,\n 442,\n 527,\n 542,\n 453,\n 435,\n 385,\n 250,\n 219,\n 153,\n 163,\n 122,\n 110\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 20.0,\n \"SKU_Premium\": 30.0,\n \"SKU_ShortLife\": 20.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 512565.0} {"scenario_id": "retail_f1_jit_logic_v3", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_jit_logic_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4555.306381840641,\n \"DC2\": 3422.9891952366816,\n \"DC3\": 3109.676300553904,\n \"DC4\": 2978.9533068169394,\n \"DC5\": 2419.4473267149483\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 344,\n 349,\n 329,\n 376,\n 437,\n 599,\n 604,\n 928,\n 959,\n 1064,\n 1163,\n 1146,\n 936,\n 781,\n 660,\n 601,\n 444,\n 356,\n 359,\n 316\n ],\n \"SKU_Premium\": [\n 141,\n 159,\n 148,\n 185,\n 196,\n 243,\n 337,\n 512,\n 594,\n 708,\n 617,\n 697,\n 615,\n 407,\n 305,\n 270,\n 214,\n 156,\n 164,\n 156\n ],\n \"SKU_ShortLife\": [\n 115,\n 110,\n 140,\n 147,\n 196,\n 239,\n 250,\n 348,\n 415,\n 531,\n 550,\n 536,\n 454,\n 310,\n 271,\n 249,\n 173,\n 153,\n 115,\n 125\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 20.0,\n \"SKU_Premium\": 30.0,\n \"SKU_ShortLife\": 20.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 480555.0} {"scenario_id": "retail_f1_jit_logic_v4", "prompt_schema": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F1 (Core Operations)\nArchetype: retail_f1_jit_logic\nScenario ID: retail_f1_jit_logic_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis 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.\n\nStructure cues:\n- 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.\n- 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.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Substitution behavior (Basic's demand served by Premium), absence of transshipment, and zero lead times all match the baseline archetype.\n- 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.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales, with the higher holding cost forcing a just-in-time style of operation.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f1_jit_logic_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4360.258165461391,\n \"DC2\": 3699.6661096856687,\n \"DC3\": 2889.2660497979646,\n \"DC4\": 2969.6855695873214,\n \"DC5\": 2574.1834181917643\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 311,\n 267,\n 330,\n 395,\n 470,\n 548,\n 738,\n 853,\n 1188,\n 1289,\n 1443,\n 1356,\n 1201,\n 1034,\n 811,\n 496,\n 393,\n 338,\n 300,\n 356\n ],\n \"SKU_Premium\": [\n 149,\n 171,\n 173,\n 167,\n 239,\n 293,\n 363,\n 470,\n 617,\n 591,\n 571,\n 714,\n 569,\n 499,\n 302,\n 261,\n 235,\n 200,\n 153,\n 133\n ],\n \"SKU_ShortLife\": [\n 112,\n 126,\n 126,\n 132,\n 165,\n 244,\n 287,\n 328,\n 467,\n 443,\n 501,\n 508,\n 391,\n 319,\n 313,\n 191,\n 157,\n 137,\n 119,\n 128\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 20.0,\n \"SKU_Premium\": 30.0,\n \"SKU_ShortLife\": 20.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f1_jit_logic_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\": 4360.258165461391, \"DC2\": 3699.6661096856687, \"DC3\": 2889.2660497979646, \"DC4\": 2969.6855695873214, \"DC5\": 2574.1834181917643}, \"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\": [311, 267, 330, 395, 470, 548, 738, 853, 1188, 1289, 1443, 1356, 1201, 1034, 811, 496, 393, 338, 300, 356], \"SKU_Premium\": [149, 171, 173, 167, 239, 293, 363, 470, 617, 591, 571, 714, 569, 499, 302, 261, 235, 200, 153, 133], \"SKU_ShortLife\": [112, 126, 126, 132, 165, 244, 287, 328, 467, 443, 501, 508, 391, 319, 313, 191, 157, 137, 119, 128]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 539060.0} {"scenario_id": "retail_f2_cannibalization_v0", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_cannibalization_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2000.0,\n \"DC2\": 1750.0,\n \"DC3\": 1500.0,\n \"DC4\": 1500.0,\n \"DC5\": 1250.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 606,\n 622,\n 656,\n 730,\n 870,\n 1098,\n 1422,\n 1812,\n 2200,\n 2490,\n 2600,\n 2490,\n 2200,\n 1812,\n 1422,\n 1098,\n 870,\n 730,\n 656,\n 622\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 5.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_cannibalization_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\": 2000.0, \"DC2\": 1750.0, \"DC3\": 1500.0, \"DC4\": 1500.0, \"DC5\": 1250.0}, \"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\": [606, 622, 656, 730, 870, 1098, 1422, 1812, 2200, 2490, 2600, 2490, 2200, 1812, 1422, 1098, 870, 730, 656, 622], \"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\": 5.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 362918.5} {"scenario_id": "retail_f2_cannibalization_v1", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_cannibalization_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1778.8028994099282,\n \"DC2\": 1557.6602758218983,\n \"DC3\": 1361.536642922949,\n \"DC4\": 1531.1222473565335,\n \"DC5\": 1338.3709482251743\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 679,\n 617,\n 719,\n 784,\n 840,\n 1226,\n 1249,\n 1661,\n 2347,\n 2751,\n 2890,\n 2656,\n 2361,\n 1877,\n 1232,\n 939,\n 748,\n 751,\n 607,\n 647\n ],\n \"SKU_Premium\": [\n 130,\n 170,\n 157,\n 198,\n 218,\n 276,\n 403,\n 451,\n 481,\n 581,\n 698,\n 653,\n 575,\n 507,\n 322,\n 290,\n 249,\n 184,\n 162,\n 137\n ],\n \"SKU_ShortLife\": [\n 136,\n 141,\n 122,\n 133,\n 168,\n 202,\n 324,\n 339,\n 450,\n 491,\n 485,\n 431,\n 394,\n 356,\n 258,\n 192,\n 171,\n 167,\n 142,\n 126\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 5.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_cannibalization_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\": 1778.8028994099282, \"DC2\": 1557.6602758218983, \"DC3\": 1361.536642922949, \"DC4\": 1531.1222473565335, \"DC5\": 1338.3709482251743}, \"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\": [679, 617, 719, 784, 840, 1226, 1249, 1661, 2347, 2751, 2890, 2656, 2361, 1877, 1232, 939, 748, 751, 607, 647], \"SKU_Premium\": [130, 170, 157, 198, 218, 276, 403, 451, 481, 581, 698, 653, 575, 507, 322, 290, 249, 184, 162, 137], \"SKU_ShortLife\": [136, 141, 122, 133, 168, 202, 324, 339, 450, 491, 485, 431, 394, 356, 258, 192, 171, 167, 142, 126]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 5.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 367019.0} {"scenario_id": "retail_f2_cannibalization_v2", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_cannibalization_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2244.0402236247196,\n \"DC2\": 1699.331200549469,\n \"DC3\": 1280.5201027175053,\n \"DC4\": 1539.7512559729769,\n \"DC5\": 1119.0333113901247\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 637,\n 578,\n 753,\n 788,\n 831,\n 1253,\n 1398,\n 1619,\n 2460,\n 2471,\n 2232,\n 2120,\n 2129,\n 1972,\n 1595,\n 1199,\n 820,\n 727,\n 747,\n 674\n ],\n \"SKU_Premium\": [\n 146,\n 148,\n 164,\n 172,\n 188,\n 303,\n 315,\n 385,\n 519,\n 678,\n 607,\n 538,\n 476,\n 406,\n 373,\n 304,\n 241,\n 160,\n 181,\n 134\n ],\n \"SKU_ShortLife\": [\n 111,\n 127,\n 125,\n 148,\n 175,\n 223,\n 312,\n 372,\n 387,\n 516,\n 525,\n 563,\n 455,\n 359,\n 268,\n 186,\n 172,\n 157,\n 116,\n 110\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 5.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_cannibalization_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\": 2244.0402236247196, \"DC2\": 1699.331200549469, \"DC3\": 1280.5201027175053, \"DC4\": 1539.7512559729769, \"DC5\": 1119.0333113901247}, \"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\": [637, 578, 753, 788, 831, 1253, 1398, 1619, 2460, 2471, 2232, 2120, 2129, 1972, 1595, 1199, 820, 727, 747, 674], \"SKU_Premium\": [146, 148, 164, 172, 188, 303, 315, 385, 519, 678, 607, 538, 476, 406, 373, 304, 241, 160, 181, 134], \"SKU_ShortLife\": [111, 127, 125, 148, 175, 223, 312, 372, 387, 516, 525, 563, 455, 359, 268, 186, 172, 157, 116, 110]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 5.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 352674.0} {"scenario_id": "retail_f2_cannibalization_v3", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_cannibalization_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2159.267870664336,\n \"DC2\": 1947.1171093504597,\n \"DC3\": 1484.7541613610883,\n \"DC4\": 1517.4769188514363,\n \"DC5\": 1359.4549478997042\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 535,\n 549,\n 722,\n 665,\n 990,\n 1229,\n 1406,\n 1546,\n 2147,\n 2418,\n 2875,\n 2175,\n 2027,\n 1984,\n 1633,\n 1129,\n 843,\n 777,\n 672,\n 646\n ],\n \"SKU_Premium\": [\n 136,\n 175,\n 175,\n 178,\n 201,\n 279,\n 407,\n 473,\n 489,\n 641,\n 569,\n 563,\n 506,\n 437,\n 325,\n 306,\n 220,\n 192,\n 168,\n 141\n ],\n \"SKU_ShortLife\": [\n 111,\n 122,\n 118,\n 138,\n 173,\n 199,\n 318,\n 309,\n 380,\n 528,\n 590,\n 475,\n 480,\n 307,\n 276,\n 201,\n 191,\n 153,\n 133,\n 113\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 5.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_cannibalization_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\": 2159.267870664336, \"DC2\": 1947.1171093504597, \"DC3\": 1484.7541613610883, \"DC4\": 1517.4769188514363, \"DC5\": 1359.4549478997042}, \"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\": [535, 549, 722, 665, 990, 1229, 1406, 1546, 2147, 2418, 2875, 2175, 2027, 1984, 1633, 1129, 843, 777, 672, 646], \"SKU_Premium\": [136, 175, 175, 178, 201, 279, 407, 473, 489, 641, 569, 563, 506, 437, 325, 306, 220, 192, 168, 141], \"SKU_ShortLife\": [111, 122, 118, 138, 173, 199, 318, 309, 380, 528, 590, 475, 480, 307, 276, 201, 191, 153, 133, 113]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 5.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 355445.5} {"scenario_id": "retail_f2_cannibalization_v4", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_cannibalization\nScenario ID: retail_f2_cannibalization_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer heavily promotes a low-margin basic product, strongly increasing its demand and making lost sales on that product relatively cheap, while shared storage is tightened. Because all products share limited storage, stocking more of the promoted basic product can displace higher-margin premium and short-life items. Customers can still switch along the substitution pattern in the category, but the promotional focus on the basic product creates cannibalization pressure.\n\nStructure cues:\n- The underlying inventory and substitution structure is the same as in retail_f2_circular_sub, with a single-echelon system, shared storage at each location, and a directed substitution graph defined in the JSON.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON reduces storage capacity, making space more scarce.\n- The JSON increases demand for the basic product and reduces its lost sales penalty while keeping higher margins on other items.\n- Tight shared storage capacity means that choosing to stock more of the basic product can crowd out premium and short-life items in the warehouse, purely through the capacity and cost parameters.\n- Inventory remains non-negative, lost sales capture unsatisfied demand after substitution, and there is still no transshipment or backordering.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), and the cannibalization effect is driven by the interplay of demand, margin, lost sales penalties, and capacity parameters rather than by any change to the model's basic structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_cannibalization_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2130.0920075505283,\n \"DC2\": 1791.593449254044,\n \"DC3\": 1333.4028661526593,\n \"DC4\": 1355.7222579803988,\n \"DC5\": 1135.6893821866583\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 523,\n 585,\n 727,\n 652,\n 890,\n 1034,\n 1410,\n 1630,\n 2505,\n 2393,\n 2510,\n 2326,\n 2212,\n 1892,\n 1553,\n 1170,\n 989,\n 748,\n 654,\n 692\n ],\n \"SKU_Premium\": [\n 140,\n 143,\n 159,\n 201,\n 219,\n 300,\n 359,\n 433,\n 616,\n 659,\n 660,\n 551,\n 567,\n 509,\n 326,\n 254,\n 224,\n 155,\n 149,\n 175\n ],\n \"SKU_ShortLife\": [\n 115,\n 107,\n 122,\n 153,\n 182,\n 226,\n 291,\n 349,\n 377,\n 552,\n 527,\n 425,\n 481,\n 414,\n 304,\n 248,\n 196,\n 155,\n 143,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 5.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_cannibalization_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\": 2130.0920075505283, \"DC2\": 1791.593449254044, \"DC3\": 1333.4028661526593, \"DC4\": 1355.7222579803988, \"DC5\": 1135.6893821866583}, \"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\": [523, 585, 727, 652, 890, 1034, 1410, 1630, 2505, 2393, 2510, 2326, 2212, 1892, 1553, 1170, 989, 748, 654, 692], \"SKU_Premium\": [140, 143, 159, 201, 219, 300, 359, 433, 616, 659, 660, 551, 567, 509, 326, 254, 224, 155, 149, 175], \"SKU_ShortLife\": [115, 107, 122, 153, 182, 226, 291, 349, 377, 552, 527, 425, 481, 414, 304, 248, 196, 155, 143, 106]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 5.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 367405.0} {"scenario_id": "retail_f2_circular_sub_v0", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_circular_sub_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ],\n [\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n [\n \"SKU_ShortLife\",\n \"SKU_Basic\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_circular_sub_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\"], [\"SKU_Premium\", \"SKU_ShortLife\"], [\"SKU_ShortLife\", \"SKU_Basic\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 347594.0} {"scenario_id": "retail_f2_circular_sub_v1", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_circular_sub_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4588.825236933483,\n \"DC2\": 3817.8607505060004,\n \"DC3\": 2852.2628502006805,\n \"DC4\": 2899.198618699413,\n \"DC5\": 2452.806717338397\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 313,\n 357,\n 297,\n 409,\n 475,\n 623,\n 790,\n 860,\n 1244,\n 1356,\n 1168,\n 1093,\n 978,\n 1028,\n 720,\n 553,\n 412,\n 344,\n 319,\n 299\n ],\n \"SKU_Premium\": [\n 141,\n 157,\n 165,\n 207,\n 219,\n 269,\n 374,\n 432,\n 505,\n 575,\n 697,\n 620,\n 517,\n 481,\n 371,\n 295,\n 215,\n 200,\n 169,\n 175\n ],\n \"SKU_ShortLife\": [\n 119,\n 129,\n 125,\n 151,\n 184,\n 221,\n 316,\n 368,\n 396,\n 508,\n 446,\n 554,\n 395,\n 359,\n 248,\n 245,\n 148,\n 132,\n 149,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ],\n [\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n [\n \"SKU_ShortLife\",\n \"SKU_Basic\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_circular_sub_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\": 4588.825236933483, \"DC2\": 3817.8607505060004, \"DC3\": 2852.2628502006805, \"DC4\": 2899.198618699413, \"DC5\": 2452.806717338397}, \"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\": [313, 357, 297, 409, 475, 623, 790, 860, 1244, 1356, 1168, 1093, 978, 1028, 720, 553, 412, 344, 319, 299], \"SKU_Premium\": [141, 157, 165, 207, 219, 269, 374, 432, 505, 575, 697, 620, 517, 481, 371, 295, 215, 200, 169, 175], \"SKU_ShortLife\": [119, 129, 125, 151, 184, 221, 316, 368, 396, 508, 446, 554, 395, 359, 248, 245, 148, 132, 149, 130]}, \"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\"], [\"SKU_Premium\", \"SKU_ShortLife\"], [\"SKU_ShortLife\", \"SKU_Basic\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 348252.0} {"scenario_id": "retail_f2_circular_sub_v2", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_circular_sub_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3858.821627833047,\n \"DC2\": 3199.8547138582135,\n \"DC3\": 2943.8767327995683,\n \"DC4\": 2602.832055899518,\n \"DC5\": 2698.77770496729\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 321,\n 334,\n 299,\n 344,\n 434,\n 585,\n 623,\n 786,\n 1156,\n 1325,\n 1356,\n 1360,\n 963,\n 873,\n 680,\n 547,\n 443,\n 321,\n 360,\n 273\n ],\n \"SKU_Premium\": [\n 138,\n 155,\n 172,\n 208,\n 200,\n 300,\n 393,\n 470,\n 532,\n 613,\n 633,\n 551,\n 544,\n 446,\n 330,\n 283,\n 243,\n 205,\n 152,\n 176\n ],\n \"SKU_ShortLife\": [\n 109,\n 126,\n 136,\n 148,\n 192,\n 195,\n 266,\n 345,\n 385,\n 547,\n 517,\n 464,\n 468,\n 361,\n 265,\n 199,\n 170,\n 127,\n 121,\n 139\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ],\n [\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n [\n \"SKU_ShortLife\",\n \"SKU_Basic\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_circular_sub_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\": 3858.821627833047, \"DC2\": 3199.8547138582135, \"DC3\": 2943.8767327995683, \"DC4\": 2602.832055899518, \"DC5\": 2698.77770496729}, \"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\": [321, 334, 299, 344, 434, 585, 623, 786, 1156, 1325, 1356, 1360, 963, 873, 680, 547, 443, 321, 360, 273], \"SKU_Premium\": [138, 155, 172, 208, 200, 300, 393, 470, 532, 613, 633, 551, 544, 446, 330, 283, 243, 205, 152, 176], \"SKU_ShortLife\": [109, 126, 136, 148, 192, 195, 266, 345, 385, 547, 517, 464, 468, 361, 265, 199, 170, 127, 121, 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\"], [\"SKU_Premium\", \"SKU_ShortLife\"], [\"SKU_ShortLife\", \"SKU_Basic\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 342916.0} {"scenario_id": "retail_f2_circular_sub_v3", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_circular_sub_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3462.23662947628,\n \"DC2\": 3989.713994899447,\n \"DC3\": 2795.6840758104636,\n \"DC4\": 3207.3520166764847,\n \"DC5\": 2480.6254358169203\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 335,\n 266,\n 286,\n 316,\n 491,\n 531,\n 796,\n 901,\n 1064,\n 1362,\n 1300,\n 1214,\n 1029,\n 844,\n 792,\n 572,\n 495,\n 398,\n 281,\n 316\n ],\n \"SKU_Premium\": [\n 157,\n 170,\n 143,\n 202,\n 246,\n 258,\n 402,\n 444,\n 622,\n 591,\n 666,\n 699,\n 569,\n 474,\n 328,\n 255,\n 243,\n 168,\n 181,\n 159\n ],\n \"SKU_ShortLife\": [\n 132,\n 113,\n 116,\n 127,\n 152,\n 238,\n 297,\n 312,\n 399,\n 487,\n 471,\n 555,\n 409,\n 311,\n 246,\n 212,\n 170,\n 142,\n 135,\n 141\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ],\n [\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n [\n \"SKU_ShortLife\",\n \"SKU_Basic\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_circular_sub_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\": 3462.23662947628, \"DC2\": 3989.713994899447, \"DC3\": 2795.6840758104636, \"DC4\": 3207.3520166764847, \"DC5\": 2480.6254358169203}, \"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\": [335, 266, 286, 316, 491, 531, 796, 901, 1064, 1362, 1300, 1214, 1029, 844, 792, 572, 495, 398, 281, 316], \"SKU_Premium\": [157, 170, 143, 202, 246, 258, 402, 444, 622, 591, 666, 699, 569, 474, 328, 255, 243, 168, 181, 159], \"SKU_ShortLife\": [132, 113, 116, 127, 152, 238, 297, 312, 399, 487, 471, 555, 409, 311, 246, 212, 170, 142, 135, 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\": 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\"], [\"SKU_Premium\", \"SKU_ShortLife\"], [\"SKU_ShortLife\", \"SKU_Basic\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 348595.0} {"scenario_id": "retail_f2_circular_sub_v4", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_circular_sub\nScenario ID: retail_f2_circular_sub_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer offers several products in a category where customers are willing to switch along a circular pattern when their first choice is unavailable. The basic, premium, and short-life products form a directed substitution ring, so demand may move from one item to the next according to that ring. Demand remains exogenous by product and location, and any demand that cannot be satisfied even after considering allowed substitution is treated as a lost sale.\n\nStructure cues:\n- The overall structure is still single-echelon inventory with per-product production capacities, local storage, and lost sales when demand is not met.\n- Inventory at each location evolves from carried-over stock, new production, sales to customers who originally requested that product, and sales to customers diverted from other products along the substitution ring, minus any discarded units. Inventory must remain non-negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph in the JSON defines a directed ring among the products. Each edge [A, B] means A's demand can be served by B's inventory. When demand for product A cannot be fully served from A's own stock, the model may serve part of that demand using B's inventory if edge [A, B] exists.\n- Any remaining unmet demand after using all allowed substitutions becomes lost sales with a penalty cost. Customers are not backordered.\n- Zero lead times remain in effect, and there is no transshipment between locations.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the substitution pattern encoded in the JSON.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_circular_sub_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3752.9461758346024,\n \"DC2\": 3737.14604169585,\n \"DC3\": 3124.3037966979764,\n \"DC4\": 3111.6473701379737,\n \"DC5\": 2173.22913323354\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 290,\n 310,\n 376,\n 355,\n 459,\n 606,\n 635,\n 976,\n 1032,\n 1261,\n 1213,\n 1316,\n 992,\n 949,\n 668,\n 499,\n 463,\n 364,\n 350,\n 350\n ],\n \"SKU_Premium\": [\n 129,\n 172,\n 147,\n 182,\n 241,\n 282,\n 323,\n 481,\n 549,\n 606,\n 720,\n 564,\n 501,\n 438,\n 319,\n 267,\n 199,\n 173,\n 155,\n 156\n ],\n \"SKU_ShortLife\": [\n 104,\n 124,\n 125,\n 148,\n 183,\n 240,\n 308,\n 374,\n 497,\n 509,\n 558,\n 475,\n 443,\n 376,\n 317,\n 214,\n 199,\n 129,\n 150,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ],\n [\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n [\n \"SKU_ShortLife\",\n \"SKU_Basic\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_circular_sub_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\": 3752.9461758346024, \"DC2\": 3737.14604169585, \"DC3\": 3124.3037966979764, \"DC4\": 3111.6473701379737, \"DC5\": 2173.22913323354}, \"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\": [290, 310, 376, 355, 459, 606, 635, 976, 1032, 1261, 1213, 1316, 992, 949, 668, 499, 463, 364, 350, 350], \"SKU_Premium\": [129, 172, 147, 182, 241, 282, 323, 481, 549, 606, 720, 564, 501, 438, 319, 267, 199, 173, 155, 156], \"SKU_ShortLife\": [104, 124, 125, 148, 183, 240, 308, 374, 497, 509, 558, 475, 443, 376, 317, 214, 199, 129, 150, 106]}, \"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\"], [\"SKU_Premium\", \"SKU_ShortLife\"], [\"SKU_ShortLife\", \"SKU_Basic\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 346881.0} {"scenario_id": "retail_f2_no_substitution_v0", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_no_substitution_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_no_substitution_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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f2_no_substitution_v1", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_no_substitution_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4594.849055105259,\n \"DC2\": 3369.1125228697274,\n \"DC3\": 2560.8368277444156,\n \"DC4\": 3331.2426314946406,\n \"DC5\": 2646.2119480166125\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 296,\n 352,\n 309,\n 344,\n 475,\n 612,\n 693,\n 883,\n 1007,\n 1214,\n 1427,\n 1157,\n 1103,\n 936,\n 785,\n 579,\n 391,\n 379,\n 279,\n 310\n ],\n \"SKU_Premium\": [\n 139,\n 150,\n 147,\n 172,\n 241,\n 283,\n 344,\n 518,\n 573,\n 635,\n 741,\n 639,\n 628,\n 519,\n 365,\n 268,\n 194,\n 195,\n 180,\n 169\n ],\n \"SKU_ShortLife\": [\n 137,\n 138,\n 139,\n 164,\n 154,\n 218,\n 303,\n 361,\n 396,\n 542,\n 510,\n 565,\n 420,\n 408,\n 281,\n 197,\n 190,\n 154,\n 114,\n 136\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_no_substitution_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\": 4594.849055105259, \"DC2\": 3369.1125228697274, \"DC3\": 2560.8368277444156, \"DC4\": 3331.2426314946406, \"DC5\": 2646.2119480166125}, \"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\": [296, 352, 309, 344, 475, 612, 693, 883, 1007, 1214, 1427, 1157, 1103, 936, 785, 579, 391, 379, 279, 310], \"SKU_Premium\": [139, 150, 147, 172, 241, 283, 344, 518, 573, 635, 741, 639, 628, 519, 365, 268, 194, 195, 180, 169], \"SKU_ShortLife\": [137, 138, 139, 164, 154, 218, 303, 361, 396, 542, 510, 565, 420, 408, 281, 197, 190, 154, 114, 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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 399083.5} {"scenario_id": "retail_f2_no_substitution_v2", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_no_substitution_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4530.2463124172755,\n \"DC2\": 3341.4403177853974,\n \"DC3\": 3248.8934776584942,\n \"DC4\": 3310.1763863048486,\n \"DC5\": 2569.5986589116396\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 319,\n 314,\n 321,\n 339,\n 438,\n 605,\n 789,\n 770,\n 1102,\n 1069,\n 1217,\n 1130,\n 977,\n 923,\n 681,\n 492,\n 488,\n 317,\n 286,\n 308\n ],\n \"SKU_Premium\": [\n 134,\n 157,\n 162,\n 181,\n 240,\n 309,\n 381,\n 460,\n 584,\n 614,\n 613,\n 649,\n 624,\n 398,\n 317,\n 295,\n 209,\n 190,\n 149,\n 158\n ],\n \"SKU_ShortLife\": [\n 109,\n 113,\n 126,\n 129,\n 189,\n 241,\n 260,\n 394,\n 427,\n 536,\n 576,\n 489,\n 435,\n 395,\n 276,\n 206,\n 154,\n 167,\n 147,\n 127\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_no_substitution_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\": 4530.2463124172755, \"DC2\": 3341.4403177853974, \"DC3\": 3248.8934776584942, \"DC4\": 3310.1763863048486, \"DC5\": 2569.5986589116396}, \"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, 314, 321, 339, 438, 605, 789, 770, 1102, 1069, 1217, 1130, 977, 923, 681, 492, 488, 317, 286, 308], \"SKU_Premium\": [134, 157, 162, 181, 240, 309, 381, 460, 584, 614, 613, 649, 624, 398, 317, 295, 209, 190, 149, 158], \"SKU_ShortLife\": [109, 113, 126, 129, 189, 241, 260, 394, 427, 536, 576, 489, 435, 395, 276, 206, 154, 167, 147, 127]}, \"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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 372422.0} {"scenario_id": "retail_f2_no_substitution_v3", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_no_substitution_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4143.868514996318,\n \"DC2\": 3121.3812599787016,\n \"DC3\": 2980.2287652786576,\n \"DC4\": 2779.593856611721,\n \"DC5\": 2461.964259537608\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 299,\n 333,\n 366,\n 373,\n 468,\n 583,\n 802,\n 1016,\n 1165,\n 1333,\n 1189,\n 1413,\n 1235,\n 988,\n 649,\n 601,\n 384,\n 316,\n 316,\n 280\n ],\n \"SKU_Premium\": [\n 128,\n 138,\n 166,\n 192,\n 187,\n 296,\n 393,\n 509,\n 593,\n 623,\n 717,\n 582,\n 553,\n 435,\n 370,\n 239,\n 239,\n 180,\n 152,\n 164\n ],\n \"SKU_ShortLife\": [\n 134,\n 139,\n 140,\n 132,\n 157,\n 230,\n 290,\n 384,\n 379,\n 571,\n 525,\n 509,\n 429,\n 376,\n 319,\n 200,\n 150,\n 142,\n 150,\n 108\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_no_substitution_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\": 4143.868514996318, \"DC2\": 3121.3812599787016, \"DC3\": 2980.2287652786576, \"DC4\": 2779.593856611721, \"DC5\": 2461.964259537608}, \"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\": [299, 333, 366, 373, 468, 583, 802, 1016, 1165, 1333, 1189, 1413, 1235, 988, 649, 601, 384, 316, 316, 280], \"SKU_Premium\": [128, 138, 166, 192, 187, 296, 393, 509, 593, 623, 717, 582, 553, 435, 370, 239, 239, 180, 152, 164], \"SKU_ShortLife\": [134, 139, 140, 132, 157, 230, 290, 384, 379, 571, 525, 509, 429, 376, 319, 200, 150, 142, 150, 108]}, \"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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 406316.5} {"scenario_id": "retail_f2_no_substitution_v4", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_no_substitution\nScenario ID: retail_f2_no_substitution_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer manages multiple products that do not substitute for each other. Customers either buy the specific product they requested or, if it is unavailable, do not purchase anything and generate a lost sale. Demand for each product at each location is exogenous and seasonal. Inventory is held locally with no transshipment and no backorders, and there is no cross-product switching under any circumstances.\n\nStructure cues:\n- The physical setup matches retail_f1_base: single-echelon, multi-product, multi-location, with inventory held only at the locations that serve final demand.\n- Inventory at each location and period starts from the previous period's ending stock, is increased by local production or procurement, and is decreased by sales and waste. Stock cannot become negative.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In this archetype, the substitution graph in the JSON is empty (sub_edges = []). The model must not allow demand for one product to be satisfied by any other product; each product's demand can only be met by its own on-hand inventory at that location.\n- There is no transshipment of inventory between locations, lead times are effectively zero, and labor capacity is large relative to demand.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales without any cross-product substitution logic.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_no_substitution_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4260.278490066865,\n \"DC2\": 3315.338938753029,\n \"DC3\": 2883.82686409195,\n \"DC4\": 2886.8885213083827,\n \"DC5\": 2143.9514310524273\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 291,\n 356,\n 279,\n 378,\n 388,\n 548,\n 777,\n 895,\n 1003,\n 1302,\n 1129,\n 1319,\n 1202,\n 958,\n 775,\n 500,\n 411,\n 357,\n 330,\n 311\n ],\n \"SKU_Premium\": [\n 129,\n 163,\n 180,\n 183,\n 207,\n 293,\n 339,\n 511,\n 614,\n 684,\n 670,\n 679,\n 477,\n 495,\n 319,\n 266,\n 239,\n 168,\n 154,\n 141\n ],\n \"SKU_ShortLife\": [\n 103,\n 118,\n 143,\n 145,\n 161,\n 203,\n 280,\n 350,\n 472,\n 539,\n 537,\n 467,\n 379,\n 348,\n 254,\n 235,\n 175,\n 143,\n 144,\n 111\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_no_substitution_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\": 4260.278490066865, \"DC2\": 3315.338938753029, \"DC3\": 2883.82686409195, \"DC4\": 2886.8885213083827, \"DC5\": 2143.9514310524273}, \"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\": [291, 356, 279, 378, 388, 548, 777, 895, 1003, 1302, 1129, 1319, 1202, 958, 775, 500, 411, 357, 330, 311], \"SKU_Premium\": [129, 163, 180, 183, 207, 293, 339, 511, 614, 684, 670, 679, 477, 495, 319, 266, 239, 168, 154, 141], \"SKU_ShortLife\": [103, 118, 143, 145, 161, 203, 280, 350, 472, 539, 537, 467, 379, 348, 254, 235, 175, 143, 144, 111]}, \"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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 385892.0} {"scenario_id": "retail_f2_price_band_tight_v0", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_price_band_tight_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 160.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 11.0,\n \"SKU_Premium\": 16.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_price_band_tight_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\": 160.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\": 11.0, \"SKU_Premium\": 16.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 365474.5} {"scenario_id": "retail_f2_price_band_tight_v1", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_price_band_tight_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4445.6810643573535,\n \"DC2\": 3521.2582938498463,\n \"DC3\": 3047.593282264405,\n \"DC4\": 3344.9192979551704,\n \"DC5\": 2461.136827380781\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 305,\n 326,\n 367,\n 350,\n 463,\n 494,\n 740,\n 928,\n 1208,\n 1359,\n 1386,\n 1166,\n 1066,\n 827,\n 782,\n 512,\n 460,\n 321,\n 350,\n 280\n ],\n \"SKU_Premium\": [\n 144,\n 162,\n 139,\n 189,\n 187,\n 273,\n 371,\n 504,\n 572,\n 712,\n 649,\n 546,\n 498,\n 399,\n 331,\n 279,\n 218,\n 169,\n 158,\n 159\n ],\n \"SKU_ShortLife\": [\n 138,\n 132,\n 137,\n 130,\n 185,\n 237,\n 322,\n 366,\n 471,\n 451,\n 509,\n 532,\n 442,\n 387,\n 295,\n 242,\n 182,\n 155,\n 148,\n 139\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 160.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 11.0,\n \"SKU_Premium\": 16.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_price_band_tight_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\": 4445.6810643573535, \"DC2\": 3521.2582938498463, \"DC3\": 3047.593282264405, \"DC4\": 3344.9192979551704, \"DC5\": 2461.136827380781}, \"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\": [305, 326, 367, 350, 463, 494, 740, 928, 1208, 1359, 1386, 1166, 1066, 827, 782, 512, 460, 321, 350, 280], \"SKU_Premium\": [144, 162, 139, 189, 187, 273, 371, 504, 572, 712, 649, 546, 498, 399, 331, 279, 218, 169, 158, 159], \"SKU_ShortLife\": [138, 132, 137, 130, 185, 237, 322, 366, 471, 451, 509, 532, 442, 387, 295, 242, 182, 155, 148, 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\": 160.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\": 11.0, \"SKU_Premium\": 16.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 368586.0} {"scenario_id": "retail_f2_price_band_tight_v2", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_price_band_tight_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4428.925839469926,\n \"DC2\": 3413.0724185973922,\n \"DC3\": 2931.031094470947,\n \"DC4\": 3023.386533565639,\n \"DC5\": 2749.119772107613\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 347,\n 352,\n 355,\n 403,\n 474,\n 498,\n 748,\n 890,\n 1002,\n 1422,\n 1276,\n 1334,\n 1129,\n 878,\n 767,\n 531,\n 376,\n 341,\n 289,\n 285\n ],\n \"SKU_Premium\": [\n 165,\n 138,\n 180,\n 186,\n 248,\n 301,\n 407,\n 434,\n 625,\n 665,\n 693,\n 606,\n 485,\n 516,\n 393,\n 274,\n 209,\n 173,\n 164,\n 168\n ],\n \"SKU_ShortLife\": [\n 124,\n 138,\n 115,\n 140,\n 196,\n 188,\n 250,\n 399,\n 456,\n 568,\n 552,\n 538,\n 392,\n 362,\n 293,\n 190,\n 187,\n 150,\n 143,\n 131\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 160.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 11.0,\n \"SKU_Premium\": 16.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_price_band_tight_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\": 4428.925839469926, \"DC2\": 3413.0724185973922, \"DC3\": 2931.031094470947, \"DC4\": 3023.386533565639, \"DC5\": 2749.119772107613}, \"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\": [347, 352, 355, 403, 474, 498, 748, 890, 1002, 1422, 1276, 1334, 1129, 878, 767, 531, 376, 341, 289, 285], \"SKU_Premium\": [165, 138, 180, 186, 248, 301, 407, 434, 625, 665, 693, 606, 485, 516, 393, 274, 209, 173, 164, 168], \"SKU_ShortLife\": [124, 138, 115, 140, 196, 188, 250, 399, 456, 568, 552, 538, 392, 362, 293, 190, 187, 150, 143, 131]}, \"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\": 160.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\": 11.0, \"SKU_Premium\": 16.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 384738.5} {"scenario_id": "retail_f2_price_band_tight_v3", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_price_band_tight_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3426.851027013356,\n \"DC2\": 4014.3338689418874,\n \"DC3\": 2845.2151192755423,\n \"DC4\": 2932.70194359208,\n \"DC5\": 2291.9453290268225\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 304,\n 290,\n 361,\n 363,\n 493,\n 483,\n 660,\n 998,\n 1122,\n 1147,\n 1224,\n 1151,\n 1115,\n 859,\n 696,\n 610,\n 386,\n 344,\n 301,\n 328\n ],\n \"SKU_Premium\": [\n 148,\n 141,\n 175,\n 169,\n 216,\n 236,\n 345,\n 475,\n 600,\n 613,\n 716,\n 702,\n 477,\n 425,\n 402,\n 288,\n 211,\n 191,\n 164,\n 161\n ],\n \"SKU_ShortLife\": [\n 135,\n 128,\n 132,\n 139,\n 148,\n 189,\n 295,\n 380,\n 420,\n 508,\n 520,\n 445,\n 436,\n 376,\n 273,\n 216,\n 183,\n 167,\n 150,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 160.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 11.0,\n \"SKU_Premium\": 16.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_price_band_tight_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\": 3426.851027013356, \"DC2\": 4014.3338689418874, \"DC3\": 2845.2151192755423, \"DC4\": 2932.70194359208, \"DC5\": 2291.9453290268225}, \"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\": [304, 290, 361, 363, 493, 483, 660, 998, 1122, 1147, 1224, 1151, 1115, 859, 696, 610, 386, 344, 301, 328], \"SKU_Premium\": [148, 141, 175, 169, 216, 236, 345, 475, 600, 613, 716, 702, 477, 425, 402, 288, 211, 191, 164, 161], \"SKU_ShortLife\": [135, 128, 132, 139, 148, 189, 295, 380, 420, 508, 520, 445, 436, 376, 273, 216, 183, 167, 150, 106]}, \"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\": 160.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\": 11.0, \"SKU_Premium\": 16.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 361787.5} {"scenario_id": "retail_f2_price_band_tight_v4", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_price_band_tight\nScenario ID: retail_f2_price_band_tight_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a category with a value-oriented basic product and a premium product that are sold under tight price bands and margin trade-offs. Premium carries higher effective margin and stricter implicit service expectations, while basic is cheaper but more price sensitive. When Basic inventory is insufficient, Basic's demand can be served by Premium (upward substitution); the reverse does not occur. Unmet demand after this limited upgrade behavior is lost and penalized.\n\nStructure cues:\n- The physical and inventory structure follows the same pattern as in retail_f1_base: single-echelon, local demand, local inventory, shared storage, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The substitution graph contains a single directed edge [Basic, Premium]. This means: when Basic inventory is insufficient, Premium inventory can serve Basic's demand. S[Basic, Premium] represents units of Basic's demand fulfilled by Premium.\n- Lost sales penalties and purchasing or production costs in the JSON make premium more valuable to protect and basic cheaper but more elastic. This asymmetry is expressed through cost parameters, not through any special-case constraints.\n- Inventory remains non-negative; any demand that cannot be satisfied even after allowing the basic-to-premium substitution is recorded as lost sales.\n- There is no transshipment, lead times are effectively zero, and labor capacity is non-binding.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales while respecting the one-way substitution rule and storage capacity limits.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_price_band_tight_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3427.627149702561,\n \"DC2\": 3132.062723953799,\n \"DC3\": 2714.118544653094,\n \"DC4\": 2672.4786538885255,\n \"DC5\": 2561.026704650092\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 268,\n 313,\n 345,\n 390,\n 442,\n 479,\n 785,\n 905,\n 1015,\n 1418,\n 1200,\n 1223,\n 1032,\n 835,\n 733,\n 542,\n 378,\n 393,\n 332,\n 298\n ],\n \"SKU_Premium\": [\n 130,\n 163,\n 173,\n 156,\n 210,\n 304,\n 341,\n 473,\n 564,\n 547,\n 575,\n 563,\n 627,\n 514,\n 332,\n 304,\n 203,\n 158,\n 165,\n 164\n ],\n \"SKU_ShortLife\": [\n 124,\n 126,\n 148,\n 156,\n 193,\n 209,\n 319,\n 336,\n 492,\n 554,\n 555,\n 527,\n 403,\n 310,\n 307,\n 196,\n 190,\n 162,\n 119,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 160.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 11.0,\n \"SKU_Premium\": 16.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_price_band_tight_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\": 3427.627149702561, \"DC2\": 3132.062723953799, \"DC3\": 2714.118544653094, \"DC4\": 2672.4786538885255, \"DC5\": 2561.026704650092}, \"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, 313, 345, 390, 442, 479, 785, 905, 1015, 1418, 1200, 1223, 1032, 835, 733, 542, 378, 393, 332, 298], \"SKU_Premium\": [130, 163, 173, 156, 210, 304, 341, 473, 564, 547, 575, 563, 627, 514, 332, 304, 203, 158, 165, 164], \"SKU_ShortLife\": [124, 126, 148, 156, 193, 209, 319, 336, 492, 554, 555, 527, 403, 310, 307, 196, 190, 162, 119, 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\": 160.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\": 11.0, \"SKU_Premium\": 16.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 362825.0} {"scenario_id": "retail_f2_promo_budget_v0", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_promo_budget_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 870,\n 730,\n 656,\n 622\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 348,\n 292,\n 262,\n 248\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 15000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_promo_budget_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, 870, 730, 656, 622], \"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, 348, 292, 262, 248]}, \"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\": 15000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 539902.33} {"scenario_id": "retail_f2_promo_budget_v1", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_promo_budget_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3927.796111686252,\n \"DC2\": 3664.3480700069595,\n \"DC3\": 3239.291492965392,\n \"DC4\": 2648.7276547218867,\n \"DC5\": 2359.990813239097\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 341,\n 318,\n 355,\n 415,\n 497,\n 597,\n 775,\n 919,\n 1074,\n 1120,\n 1295,\n 1237,\n 1122,\n 796,\n 657,\n 544,\n 811,\n 822,\n 584,\n 534\n ],\n \"SKU_Premium\": [\n 155,\n 163,\n 151,\n 205,\n 211,\n 261,\n 340,\n 397,\n 515,\n 681,\n 670,\n 589,\n 531,\n 401,\n 377,\n 256,\n 208,\n 174,\n 143,\n 157\n ],\n \"SKU_ShortLife\": [\n 107,\n 115,\n 127,\n 167,\n 168,\n 245,\n 249,\n 392,\n 380,\n 559,\n 481,\n 493,\n 455,\n 348,\n 277,\n 245,\n 314,\n 250,\n 230,\n 239\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 15000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_promo_budget_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\": 3927.796111686252, \"DC2\": 3664.3480700069595, \"DC3\": 3239.291492965392, \"DC4\": 2648.7276547218867, \"DC5\": 2359.990813239097}, \"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\": [341, 318, 355, 415, 497, 597, 775, 919, 1074, 1120, 1295, 1237, 1122, 796, 657, 544, 811, 822, 584, 534], \"SKU_Premium\": [155, 163, 151, 205, 211, 261, 340, 397, 515, 681, 670, 589, 531, 401, 377, 256, 208, 174, 143, 157], \"SKU_ShortLife\": [107, 115, 127, 167, 168, 245, 249, 392, 380, 559, 481, 493, 455, 348, 277, 245, 314, 250, 230, 239]}, \"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\": 15000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 522743.92} {"scenario_id": "retail_f2_promo_budget_v2", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_promo_budget_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3514.0049602177187,\n \"DC2\": 2978.815548884458,\n \"DC3\": 3270.184260527497,\n \"DC4\": 3141.730615435521,\n \"DC5\": 2678.8726331690727\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 267,\n 279,\n 356,\n 417,\n 462,\n 581,\n 661,\n 939,\n 1182,\n 1233,\n 1321,\n 1426,\n 1082,\n 929,\n 749,\n 543,\n 956,\n 812,\n 721,\n 692\n ],\n \"SKU_Premium\": [\n 163,\n 158,\n 167,\n 160,\n 197,\n 245,\n 310,\n 520,\n 518,\n 616,\n 583,\n 548,\n 477,\n 510,\n 351,\n 235,\n 192,\n 207,\n 154,\n 177\n ],\n \"SKU_ShortLife\": [\n 137,\n 134,\n 139,\n 131,\n 181,\n 234,\n 306,\n 339,\n 489,\n 471,\n 597,\n 533,\n 403,\n 407,\n 248,\n 203,\n 370,\n 269,\n 288,\n 268\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 15000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_promo_budget_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\": 3514.0049602177187, \"DC2\": 2978.815548884458, \"DC3\": 3270.184260527497, \"DC4\": 3141.730615435521, \"DC5\": 2678.8726331690727}, \"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\": [267, 279, 356, 417, 462, 581, 661, 939, 1182, 1233, 1321, 1426, 1082, 929, 749, 543, 956, 812, 721, 692], \"SKU_Premium\": [163, 158, 167, 160, 197, 245, 310, 520, 518, 616, 583, 548, 477, 510, 351, 235, 192, 207, 154, 177], \"SKU_ShortLife\": [137, 134, 139, 131, 181, 234, 306, 339, 489, 471, 597, 533, 403, 407, 248, 203, 370, 269, 288, 268]}, \"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\": 15000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 546708.5} {"scenario_id": "retail_f2_promo_budget_v3", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_promo_budget_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4067.504721874054,\n \"DC2\": 3364.679049680995,\n \"DC3\": 3226.0592560031964,\n \"DC4\": 2560.436070515946,\n \"DC5\": 2343.357719960569\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 298,\n 310,\n 290,\n 355,\n 424,\n 582,\n 772,\n 947,\n 1126,\n 1354,\n 1227,\n 1331,\n 1080,\n 1007,\n 816,\n 621,\n 747,\n 705,\n 592,\n 571\n ],\n \"SKU_Premium\": [\n 148,\n 147,\n 164,\n 200,\n 201,\n 291,\n 353,\n 404,\n 545,\n 547,\n 610,\n 690,\n 573,\n 460,\n 337,\n 241,\n 239,\n 172,\n 158,\n 160\n ],\n \"SKU_ShortLife\": [\n 135,\n 141,\n 134,\n 140,\n 164,\n 207,\n 286,\n 344,\n 440,\n 457,\n 460,\n 535,\n 497,\n 355,\n 251,\n 225,\n 304,\n 259,\n 293,\n 260\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 15000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_promo_budget_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\": 4067.504721874054, \"DC2\": 3364.679049680995, \"DC3\": 3226.0592560031964, \"DC4\": 2560.436070515946, \"DC5\": 2343.357719960569}, \"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\": [298, 310, 290, 355, 424, 582, 772, 947, 1126, 1354, 1227, 1331, 1080, 1007, 816, 621, 747, 705, 592, 571], \"SKU_Premium\": [148, 147, 164, 200, 201, 291, 353, 404, 545, 547, 610, 690, 573, 460, 337, 241, 239, 172, 158, 160], \"SKU_ShortLife\": [135, 141, 134, 140, 164, 207, 286, 344, 440, 457, 460, 535, 497, 355, 251, 225, 304, 259, 293, 260]}, \"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\": 15000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 542136.08} {"scenario_id": "retail_f2_promo_budget_v4", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_promo_budget\nScenario ID: retail_f2_promo_budget_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nIn the final periods of the horizon the retailer runs strong promotions on the basic and short-life products, causing their demand to spike. At the same time, an open-to-buy style budget limits how much can be spent in each period on inventory-related activities. The retailer must allocate inventory and spending over time so that promotion-induced demand is supported as well as possible without violating the budget caps.\n\nStructure cues:\n- The inventory and substitution structure is the usual single-echelon system with shared storage, production capacity, and a substitution graph, together with lost sales for unmet demand.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the last few periods, the JSON scales up demand for the basic and short-life products to represent promotion-induced lifts; these are treated as ordinary exogenous demands with larger magnitudes.\n- The JSON also provides a per-period budget for inventory-related spending. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory remains non-negative, and any demand that cannot be satisfied within the budget and capacity limits becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain active as in other Family 2 archetypes.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the per-period budget, making the trade-off between promotion support and resource limits explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_promo_budget_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3665.97505027651,\n \"DC2\": 3192.2769461415705,\n \"DC3\": 2776.6243625130755,\n \"DC4\": 3139.5910066903148,\n \"DC5\": 2284.8887784501344\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 271,\n 351,\n 338,\n 334,\n 469,\n 540,\n 641,\n 958,\n 1007,\n 1154,\n 1478,\n 1192,\n 1183,\n 951,\n 617,\n 627,\n 750,\n 686,\n 661,\n 710\n ],\n \"SKU_Premium\": [\n 158,\n 171,\n 156,\n 168,\n 185,\n 267,\n 342,\n 397,\n 568,\n 686,\n 601,\n 665,\n 592,\n 421,\n 325,\n 261,\n 217,\n 183,\n 165,\n 173\n ],\n \"SKU_ShortLife\": [\n 119,\n 139,\n 116,\n 148,\n 199,\n 249,\n 314,\n 350,\n 379,\n 479,\n 578,\n 436,\n 423,\n 410,\n 276,\n 242,\n 379,\n 307,\n 293,\n 277\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 15000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_promo_budget_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\": 3665.97505027651, \"DC2\": 3192.2769461415705, \"DC3\": 2776.6243625130755, \"DC4\": 3139.5910066903148, \"DC5\": 2284.8887784501344}, \"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\": [271, 351, 338, 334, 469, 540, 641, 958, 1007, 1154, 1478, 1192, 1183, 951, 617, 627, 750, 686, 661, 710], \"SKU_Premium\": [158, 171, 156, 168, 185, 267, 342, 397, 568, 686, 601, 665, 592, 421, 325, 261, 217, 183, 165, 173], \"SKU_ShortLife\": [119, 139, 116, 148, 199, 249, 314, 350, 379, 479, 578, 436, 423, 410, 276, 242, 379, 307, 293, 277]}, \"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\": 15000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 540282.08} {"scenario_id": "retail_f2_ultra_fresh_v0", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_ultra_fresh_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 2,\n \"SKU_Premium\": 2,\n \"SKU_ShortLife\": 1\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_ultra_fresh_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\": 2, \"SKU_Premium\": 2, \"SKU_ShortLife\": 1}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 454980.0} {"scenario_id": "retail_f2_ultra_fresh_v1", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_ultra_fresh_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 2,\n \"SKU_Premium\": 2,\n \"SKU_ShortLife\": 1\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4183.142994878131,\n \"DC2\": 3511.4617985383957,\n \"DC3\": 2796.598976081488,\n \"DC4\": 3114.4975244972347,\n \"DC5\": 2199.4654208538896\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 266,\n 268,\n 331,\n 383,\n 475,\n 606,\n 772,\n 972,\n 1198,\n 1153,\n 1382,\n 1171,\n 985,\n 1003,\n 670,\n 481,\n 409,\n 395,\n 371,\n 286\n ],\n \"SKU_Premium\": [\n 128,\n 141,\n 171,\n 157,\n 227,\n 247,\n 333,\n 403,\n 631,\n 658,\n 714,\n 682,\n 578,\n 407,\n 400,\n 287,\n 240,\n 205,\n 158,\n 137\n ],\n \"SKU_ShortLife\": [\n 128,\n 113,\n 120,\n 158,\n 193,\n 226,\n 263,\n 378,\n 400,\n 440,\n 493,\n 503,\n 419,\n 394,\n 262,\n 194,\n 162,\n 128,\n 146,\n 132\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_ultra_fresh_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\": 2, \"SKU_Premium\": 2, \"SKU_ShortLife\": 1}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"DC1\": 4183.142994878131, \"DC2\": 3511.4617985383957, \"DC3\": 2796.598976081488, \"DC4\": 3114.4975244972347, \"DC5\": 2199.4654208538896}, \"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\": [266, 268, 331, 383, 475, 606, 772, 972, 1198, 1153, 1382, 1171, 985, 1003, 670, 481, 409, 395, 371, 286], \"SKU_Premium\": [128, 141, 171, 157, 227, 247, 333, 403, 631, 658, 714, 682, 578, 407, 400, 287, 240, 205, 158, 137], \"SKU_ShortLife\": [128, 113, 120, 158, 193, 226, 263, 378, 400, 440, 493, 503, 419, 394, 262, 194, 162, 128, 146, 132]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 469130.5} {"scenario_id": "retail_f2_ultra_fresh_v2", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_ultra_fresh_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 2,\n \"SKU_Premium\": 2,\n \"SKU_ShortLife\": 1\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3947.3702160442394,\n \"DC2\": 3290.0400751905904,\n \"DC3\": 2683.0462935844844,\n \"DC4\": 3310.4499083646383,\n \"DC5\": 2866.4778909068746\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 317,\n 347,\n 328,\n 412,\n 479,\n 564,\n 638,\n 790,\n 950,\n 1367,\n 1323,\n 1305,\n 1067,\n 945,\n 672,\n 578,\n 470,\n 344,\n 331,\n 325\n ],\n \"SKU_Premium\": [\n 172,\n 149,\n 142,\n 200,\n 205,\n 291,\n 377,\n 470,\n 617,\n 530,\n 566,\n 619,\n 489,\n 518,\n 333,\n 263,\n 232,\n 190,\n 153,\n 156\n ],\n \"SKU_ShortLife\": [\n 117,\n 118,\n 116,\n 154,\n 153,\n 188,\n 300,\n 398,\n 374,\n 498,\n 492,\n 455,\n 417,\n 365,\n 299,\n 196,\n 191,\n 138,\n 119,\n 134\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_ultra_fresh_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\": 2, \"SKU_Premium\": 2, \"SKU_ShortLife\": 1}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"DC1\": 3947.3702160442394, \"DC2\": 3290.0400751905904, \"DC3\": 2683.0462935844844, \"DC4\": 3310.4499083646383, \"DC5\": 2866.4778909068746}, \"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\": [317, 347, 328, 412, 479, 564, 638, 790, 950, 1367, 1323, 1305, 1067, 945, 672, 578, 470, 344, 331, 325], \"SKU_Premium\": [172, 149, 142, 200, 205, 291, 377, 470, 617, 530, 566, 619, 489, 518, 333, 263, 232, 190, 153, 156], \"SKU_ShortLife\": [117, 118, 116, 154, 153, 188, 300, 398, 374, 498, 492, 455, 417, 365, 299, 196, 191, 138, 119, 134]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 443865.5} {"scenario_id": "retail_f2_ultra_fresh_v3", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_ultra_fresh_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 2,\n \"SKU_Premium\": 2,\n \"SKU_ShortLife\": 1\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4044.6217219616046,\n \"DC2\": 3712.3099143093596,\n \"DC3\": 2820.0400649419153,\n \"DC4\": 2552.0114443696934,\n \"DC5\": 2779.2237911610905\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 330,\n 327,\n 297,\n 381,\n 473,\n 563,\n 799,\n 909,\n 1053,\n 1087,\n 1127,\n 1137,\n 953,\n 807,\n 653,\n 614,\n 443,\n 350,\n 336,\n 278\n ],\n \"SKU_Premium\": [\n 159,\n 164,\n 146,\n 189,\n 230,\n 308,\n 360,\n 462,\n 541,\n 648,\n 623,\n 707,\n 516,\n 437,\n 322,\n 265,\n 193,\n 183,\n 188,\n 159\n ],\n \"SKU_ShortLife\": [\n 122,\n 117,\n 115,\n 133,\n 176,\n 218,\n 296,\n 327,\n 438,\n 434,\n 559,\n 540,\n 392,\n 408,\n 272,\n 211,\n 184,\n 140,\n 135,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_ultra_fresh_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\": 2, \"SKU_Premium\": 2, \"SKU_ShortLife\": 1}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"DC1\": 4044.6217219616046, \"DC2\": 3712.3099143093596, \"DC3\": 2820.0400649419153, \"DC4\": 2552.0114443696934, \"DC5\": 2779.2237911610905}, \"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\": [330, 327, 297, 381, 473, 563, 799, 909, 1053, 1087, 1127, 1137, 953, 807, 653, 614, 443, 350, 336, 278], \"SKU_Premium\": [159, 164, 146, 189, 230, 308, 360, 462, 541, 648, 623, 707, 516, 437, 322, 265, 193, 183, 188, 159], \"SKU_ShortLife\": [122, 117, 115, 133, 176, 218, 296, 327, 438, 434, 559, 540, 392, 408, 272, 211, 184, 140, 135, 106]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 424617.5} {"scenario_id": "retail_f2_ultra_fresh_v4", "prompt_schema": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F2 (Assortment and Substitution)\nArchetype: retail_f2_ultra_fresh\nScenario ID: retail_f2_ultra_fresh_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis scenario represents extremely short shelf-life products such as daily bakery items or ready-to-eat meals. All products must be sold very soon after arrival; otherwise they must be discarded as waste. Demand for each product at each location is seasonal and exogenous. Customers may switch between products according to the substitution graph, but only non-expired inventory can be used to satisfy demand. There are no backorders and no transshipment.\n\nStructure cues:\n- The inventory and assortment framework is the same as in the other Family 2 archetypes: single-echelon, multiple products, local demand, and an encoded substitution graph.\n- Shelf-life values in the JSON are very short, measured in periods. Inventory must be tracked by age so that units older than their shelf life are no longer eligible to serve demand.\n- When units expire they leave usable inventory and are counted as waste, incurring waste costs. Only non-expired stock can be used to satisfy original and substituted demand.\n- Inventory levels must remain non-negative; any demand that cannot be met from non-expired inventory and allowed substitution becomes lost sales.\n- Storage capacity, production capacity, the absence of transshipment, zero lead times, and generous labor capacity remain in force.\n- The objective is to minimize total cost including purchasing, short-horizon holding, waste from expiry, and lost sales.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f2_ultra_fresh_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 2,\n \"SKU_Premium\": 2,\n \"SKU_ShortLife\": 1\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4237.975898559984,\n \"DC2\": 3790.530716130663,\n \"DC3\": 2554.9351789060497,\n \"DC4\": 2872.993121158345,\n \"DC5\": 2509.306613610699\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 277,\n 327,\n 375,\n 336,\n 383,\n 620,\n 647,\n 1034,\n 1199,\n 1224,\n 1187,\n 1199,\n 1125,\n 934,\n 736,\n 627,\n 414,\n 411,\n 300,\n 320\n ],\n \"SKU_Premium\": [\n 167,\n 153,\n 184,\n 176,\n 246,\n 239,\n 330,\n 476,\n 601,\n 591,\n 671,\n 667,\n 627,\n 461,\n 400,\n 233,\n 242,\n 176,\n 143,\n 156\n ],\n \"SKU_ShortLife\": [\n 112,\n 110,\n 132,\n 137,\n 192,\n 241,\n 267,\n 354,\n 425,\n 507,\n 454,\n 493,\n 450,\n 316,\n 272,\n 235,\n 163,\n 132,\n 119,\n 121\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f2_ultra_fresh_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\": 2, \"SKU_Premium\": 2, \"SKU_ShortLife\": 1}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"DC1\": 4237.975898559984, \"DC2\": 3790.530716130663, \"DC3\": 2554.9351789060497, \"DC4\": 2872.993121158345, \"DC5\": 2509.306613610699}, \"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\": [277, 327, 375, 336, 383, 620, 647, 1034, 1199, 1224, 1187, 1199, 1125, 934, 736, 627, 414, 411, 300, 320], \"SKU_Premium\": [167, 153, 184, 176, 246, 239, 330, 476, 601, 591, 671, 667, 627, 461, 400, 233, 242, 176, 143, 156], \"SKU_ShortLife\": [112, 110, 132, 137, 192, 241, 267, 354, 425, 507, 454, 493, 450, 316, 272, 235, 163, 132, 119, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 472643.5} {"scenario_id": "retail_f3_storage_bottleneck_v0", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_storage_bottleneck_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1200.0,\n \"DC2\": 1050.0,\n \"DC3\": 900.0,\n \"DC4\": 900.0,\n \"DC5\": 750.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_storage_bottleneck_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\": 1200.0, \"DC2\": 1050.0, \"DC3\": 900.0, \"DC4\": 900.0, \"DC5\": 750.0}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 429782.4} {"scenario_id": "retail_f3_storage_bottleneck_v1", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_storage_bottleneck_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1055.8079522800297,\n \"DC2\": 1018.6134333265579,\n \"DC3\": 859.9214861012979,\n \"DC4\": 790.3183063284633,\n \"DC5\": 713.9196544245406\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 302,\n 301,\n 366,\n 379,\n 386,\n 628,\n 658,\n 784,\n 1008,\n 1187,\n 1451,\n 1335,\n 938,\n 805,\n 610,\n 600,\n 410,\n 346,\n 342,\n 302\n ],\n \"SKU_Premium\": [\n 143,\n 149,\n 160,\n 192,\n 235,\n 252,\n 393,\n 405,\n 609,\n 578,\n 724,\n 532,\n 580,\n 473,\n 325,\n 296,\n 211,\n 178,\n 161,\n 169\n ],\n \"SKU_ShortLife\": [\n 131,\n 114,\n 112,\n 156,\n 189,\n 202,\n 317,\n 338,\n 382,\n 529,\n 565,\n 483,\n 446,\n 410,\n 299,\n 186,\n 154,\n 152,\n 136,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_storage_bottleneck_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\": 1055.8079522800297, \"DC2\": 1018.6134333265579, \"DC3\": 859.9214861012979, \"DC4\": 790.3183063284633, \"DC5\": 713.9196544245406}, \"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\": [302, 301, 366, 379, 386, 628, 658, 784, 1008, 1187, 1451, 1335, 938, 805, 610, 600, 410, 346, 342, 302], \"SKU_Premium\": [143, 149, 160, 192, 235, 252, 393, 405, 609, 578, 724, 532, 580, 473, 325, 296, 211, 178, 161, 169], \"SKU_ShortLife\": [131, 114, 112, 156, 189, 202, 317, 338, 382, 529, 565, 483, 446, 410, 299, 186, 154, 152, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 428363.7} {"scenario_id": "retail_f3_storage_bottleneck_v2", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_storage_bottleneck_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1275.7199172389057,\n \"DC2\": 1106.0485166959793,\n \"DC3\": 905.8185887894177,\n \"DC4\": 882.0340831983854,\n \"DC5\": 658.5554847687304\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 331,\n 287,\n 308,\n 326,\n 478,\n 531,\n 683,\n 774,\n 1045,\n 1220,\n 1216,\n 1370,\n 997,\n 848,\n 690,\n 556,\n 464,\n 380,\n 324,\n 320\n ],\n \"SKU_Premium\": [\n 173,\n 172,\n 158,\n 187,\n 215,\n 239,\n 305,\n 385,\n 601,\n 590,\n 625,\n 625,\n 559,\n 411,\n 399,\n 279,\n 198,\n 183,\n 144,\n 141\n ],\n \"SKU_ShortLife\": [\n 119,\n 123,\n 139,\n 127,\n 170,\n 199,\n 306,\n 311,\n 384,\n 436,\n 457,\n 498,\n 496,\n 340,\n 243,\n 210,\n 198,\n 143,\n 122,\n 112\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_storage_bottleneck_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\": 1275.7199172389057, \"DC2\": 1106.0485166959793, \"DC3\": 905.8185887894177, \"DC4\": 882.0340831983854, \"DC5\": 658.5554847687304}, \"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\": [331, 287, 308, 326, 478, 531, 683, 774, 1045, 1220, 1216, 1370, 997, 848, 690, 556, 464, 380, 324, 320], \"SKU_Premium\": [173, 172, 158, 187, 215, 239, 305, 385, 601, 590, 625, 625, 559, 411, 399, 279, 198, 183, 144, 141], \"SKU_ShortLife\": [119, 123, 139, 127, 170, 199, 306, 311, 384, 436, 457, 498, 496, 340, 243, 210, 198, 143, 122, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 405046.03} {"scenario_id": "retail_f3_storage_bottleneck_v3", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_storage_bottleneck_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1327.281582216799,\n \"DC2\": 1168.4903524146278,\n \"DC3\": 1024.1576323547497,\n \"DC4\": 968.1078224441308,\n \"DC5\": 852.9966194079219\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 331,\n 287,\n 341,\n 367,\n 454,\n 500,\n 800,\n 858,\n 1178,\n 1067,\n 1433,\n 1141,\n 1216,\n 927,\n 612,\n 529,\n 414,\n 327,\n 296,\n 305\n ],\n \"SKU_Premium\": [\n 141,\n 164,\n 167,\n 180,\n 188,\n 273,\n 309,\n 493,\n 490,\n 624,\n 743,\n 624,\n 550,\n 454,\n 392,\n 308,\n 245,\n 175,\n 186,\n 158\n ],\n \"SKU_ShortLife\": [\n 115,\n 105,\n 121,\n 162,\n 159,\n 193,\n 324,\n 394,\n 407,\n 546,\n 568,\n 467,\n 466,\n 344,\n 254,\n 251,\n 190,\n 151,\n 130,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_storage_bottleneck_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\": 1327.281582216799, \"DC2\": 1168.4903524146278, \"DC3\": 1024.1576323547497, \"DC4\": 968.1078224441308, \"DC5\": 852.9966194079219}, \"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\": [331, 287, 341, 367, 454, 500, 800, 858, 1178, 1067, 1433, 1141, 1216, 927, 612, 529, 414, 327, 296, 305], \"SKU_Premium\": [141, 164, 167, 180, 188, 273, 309, 493, 490, 624, 743, 624, 550, 454, 392, 308, 245, 175, 186, 158], \"SKU_ShortLife\": [115, 105, 121, 162, 159, 193, 324, 394, 407, 546, 568, 467, 466, 344, 254, 251, 190, 151, 130, 106]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 428965.89} {"scenario_id": "retail_f3_storage_bottleneck_v4", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_storage_bottleneck\nScenario ID: retail_f3_storage_bottleneck_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAll locations share a tight storage resource that applies across all products, representing limited chilled, ambient, or dry space. Demand at each location is still exogenous and local, and inventory is not transferred between locations. The main operational challenge is that total stored volume at each site must fit within a strict capacity, so stocking one product reduces room for others.\n\nStructure cues:\n- The inventory, production, and lost sales logic is the same as in retail_f1_base: single-echelon, multiple products and locations, local demand, and no backorders or transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. This constraint is designed to be binding and central to the trade-offs.\n- Inventory levels at each location are kept non-negative and evolve from carried-over stock and new production, minus sales and waste.\n- Substitution edges, if any, are taken from the JSON and follow the standard semantics: edge [A, B] means A's demand can be served by B.\n- Production capacities, zero lead times, and generous labor capacity remain as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the tight storage constraint.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_storage_bottleneck_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1182.00878315445,\n \"DC2\": 975.086606198174,\n \"DC3\": 801.0610854428372,\n \"DC4\": 957.8138828879366,\n \"DC5\": 818.909378943503\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 318,\n 287,\n 282,\n 311,\n 423,\n 516,\n 796,\n 814,\n 1117,\n 1161,\n 1222,\n 1357,\n 988,\n 1024,\n 773,\n 479,\n 445,\n 414,\n 374,\n 306\n ],\n \"SKU_Premium\": [\n 151,\n 137,\n 162,\n 177,\n 247,\n 247,\n 402,\n 510,\n 538,\n 605,\n 634,\n 641,\n 507,\n 416,\n 343,\n 258,\n 205,\n 169,\n 174,\n 149\n ],\n \"SKU_ShortLife\": [\n 120,\n 107,\n 147,\n 155,\n 163,\n 238,\n 310,\n 379,\n 446,\n 463,\n 505,\n 545,\n 446,\n 391,\n 269,\n 219,\n 150,\n 139,\n 147,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_storage_bottleneck_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\": 1182.00878315445, \"DC2\": 975.086606198174, \"DC3\": 801.0610854428372, \"DC4\": 957.8138828879366, \"DC5\": 818.909378943503}, \"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\": [318, 287, 282, 311, 423, 516, 796, 814, 1117, 1161, 1222, 1357, 988, 1024, 773, 479, 445, 414, 374, 306], \"SKU_Premium\": [151, 137, 162, 177, 247, 247, 402, 510, 538, 605, 634, 641, 507, 416, 343, 258, 205, 169, 174, 149], \"SKU_ShortLife\": [120, 107, 147, 155, 163, 238, 310, 379, 446, 463, 505, 545, 446, 391, 269, 219, 150, 139, 147, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 424383.49} {"scenario_id": "retail_f3_supply_bottleneck_v0", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_supply_bottleneck_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 999999.0,\n \"DC2\": 999999.0,\n \"DC3\": 999999.0,\n \"DC4\": 999999.0,\n \"DC5\": 999999.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0\n ],\n \"SKU_Premium\": [\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0\n ],\n \"SKU_ShortLife\": [\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_supply_bottleneck_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\": 999999.0, \"DC2\": 999999.0, \"DC3\": 999999.0, \"DC4\": 999999.0, \"DC5\": 999999.0}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0], \"SKU_Premium\": [120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0], \"SKU_ShortLife\": [150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1021145.0} {"scenario_id": "retail_f3_supply_bottleneck_v1", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_supply_bottleneck_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1059614.6153592607,\n \"DC2\": 1114196.4763288377,\n \"DC3\": 1097372.2063868342,\n \"DC4\": 1009131.0994909529,\n \"DC5\": 960649.2079182867\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0\n ],\n \"SKU_Premium\": [\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0\n ],\n \"SKU_ShortLife\": [\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 263,\n 272,\n 348,\n 325,\n 429,\n 513,\n 684,\n 1017,\n 1093,\n 1370,\n 1387,\n 1394,\n 1154,\n 1041,\n 743,\n 580,\n 464,\n 380,\n 343,\n 285\n ],\n \"SKU_Premium\": [\n 128,\n 174,\n 175,\n 171,\n 186,\n 251,\n 387,\n 409,\n 509,\n 541,\n 572,\n 661,\n 530,\n 416,\n 339,\n 273,\n 222,\n 166,\n 178,\n 168\n ],\n \"SKU_ShortLife\": [\n 121,\n 142,\n 128,\n 155,\n 155,\n 204,\n 297,\n 337,\n 495,\n 551,\n 451,\n 534,\n 455,\n 311,\n 264,\n 193,\n 189,\n 146,\n 128,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_supply_bottleneck_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\": 1059614.6153592607, \"DC2\": 1114196.4763288377, \"DC3\": 1097372.2063868342, \"DC4\": 1009131.0994909529, \"DC5\": 960649.2079182867}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0], \"SKU_Premium\": [120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0], \"SKU_ShortLife\": [150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0]}, \"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\": [263, 272, 348, 325, 429, 513, 684, 1017, 1093, 1370, 1387, 1394, 1154, 1041, 743, 580, 464, 380, 343, 285], \"SKU_Premium\": [128, 174, 175, 171, 186, 251, 387, 409, 509, 541, 572, 661, 530, 416, 339, 273, 222, 166, 178, 168], \"SKU_ShortLife\": [121, 142, 128, 155, 155, 204, 297, 337, 495, 551, 451, 534, 455, 311, 264, 193, 189, 146, 128, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1026458.0} {"scenario_id": "retail_f3_supply_bottleneck_v2", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_supply_bottleneck_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 946970.0399827102,\n \"DC2\": 880447.1675486389,\n \"DC3\": 949324.3034532923,\n \"DC4\": 862526.3058170992,\n \"DC5\": 977649.0928957443\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0\n ],\n \"SKU_Premium\": [\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0\n ],\n \"SKU_ShortLife\": [\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 284,\n 306,\n 311,\n 383,\n 390,\n 613,\n 702,\n 893,\n 1145,\n 1342,\n 1464,\n 1150,\n 943,\n 956,\n 653,\n 569,\n 422,\n 351,\n 355,\n 329\n ],\n \"SKU_Premium\": [\n 163,\n 153,\n 168,\n 172,\n 196,\n 284,\n 375,\n 458,\n 474,\n 553,\n 605,\n 704,\n 567,\n 458,\n 351,\n 245,\n 237,\n 190,\n 165,\n 177\n ],\n \"SKU_ShortLife\": [\n 118,\n 127,\n 118,\n 142,\n 195,\n 233,\n 244,\n 344,\n 411,\n 461,\n 482,\n 539,\n 426,\n 370,\n 283,\n 217,\n 147,\n 156,\n 112,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_supply_bottleneck_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\": 946970.0399827102, \"DC2\": 880447.1675486389, \"DC3\": 949324.3034532923, \"DC4\": 862526.3058170992, \"DC5\": 977649.0928957443}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0], \"SKU_Premium\": [120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0], \"SKU_ShortLife\": [150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0]}, \"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\": [284, 306, 311, 383, 390, 613, 702, 893, 1145, 1342, 1464, 1150, 943, 956, 653, 569, 422, 351, 355, 329], \"SKU_Premium\": [163, 153, 168, 172, 196, 284, 375, 458, 474, 553, 605, 704, 567, 458, 351, 245, 237, 190, 165, 177], \"SKU_ShortLife\": [118, 127, 118, 142, 195, 233, 244, 344, 411, 461, 482, 539, 426, 370, 283, 217, 147, 156, 112, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1014502.0} {"scenario_id": "retail_f3_supply_bottleneck_v3", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_supply_bottleneck_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 984274.8528025018,\n \"DC2\": 1114181.370009113,\n \"DC3\": 1131005.7124726693,\n \"DC4\": 996232.77657489,\n \"DC5\": 1070109.43972981\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0\n ],\n \"SKU_Premium\": [\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0\n ],\n \"SKU_ShortLife\": [\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 311,\n 301,\n 300,\n 404,\n 472,\n 600,\n 722,\n 884,\n 1181,\n 1278,\n 1318,\n 1220,\n 1226,\n 894,\n 696,\n 529,\n 436,\n 359,\n 318,\n 313\n ],\n \"SKU_Premium\": [\n 131,\n 177,\n 166,\n 208,\n 200,\n 305,\n 329,\n 427,\n 502,\n 613,\n 743,\n 711,\n 551,\n 513,\n 382,\n 239,\n 193,\n 183,\n 178,\n 141\n ],\n \"SKU_ShortLife\": [\n 123,\n 131,\n 142,\n 133,\n 152,\n 238,\n 261,\n 391,\n 486,\n 519,\n 507,\n 541,\n 380,\n 308,\n 319,\n 197,\n 199,\n 152,\n 116,\n 137\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_supply_bottleneck_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\": 984274.8528025018, \"DC2\": 1114181.370009113, \"DC3\": 1131005.7124726693, \"DC4\": 996232.77657489, \"DC5\": 1070109.43972981}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0], \"SKU_Premium\": [120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0], \"SKU_ShortLife\": [150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0]}, \"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\": [311, 301, 300, 404, 472, 600, 722, 884, 1181, 1278, 1318, 1220, 1226, 894, 696, 529, 436, 359, 318, 313], \"SKU_Premium\": [131, 177, 166, 208, 200, 305, 329, 427, 502, 613, 743, 711, 551, 513, 382, 239, 193, 183, 178, 141], \"SKU_ShortLife\": [123, 131, 142, 133, 152, 238, 261, 391, 486, 519, 507, 541, 380, 308, 319, 197, 199, 152, 116, 137]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1047182.0} {"scenario_id": "retail_f3_supply_bottleneck_v4", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_supply_bottleneck\nScenario ID: retail_f3_supply_bottleneck_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage space is abundant but upstream production capacity is tight. The main bottleneck is how many units can be produced or procured each period, not how many can be stored. Demand is still exogenous, local to each location, and there are no backorders or transshipment.\n\nStructure cues:\n- The inventory and lost sales logic is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities in the JSON are set very high so that storage constraints are effectively non-binding.\n- Per-product production capacities are significantly reduced. These caps must be enforced and become the main source of unmet demand.\n- Inventory at each location and period stays non-negative and changes according to local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior is determined by the substitution graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with lost sales penalties playing a central role because of tight production capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_supply_bottleneck_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1100171.654473379,\n \"DC2\": 1095657.8622260948,\n \"DC3\": 1084235.3355647023,\n \"DC4\": 975199.3968462343,\n \"DC5\": 1018455.8155221663\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0,\n 240.0\n ],\n \"SKU_Premium\": [\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0,\n 120.0\n ],\n \"SKU_ShortLife\": [\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0,\n 150.0\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 294,\n 344,\n 338,\n 333,\n 418,\n 611,\n 693,\n 779,\n 1069,\n 1407,\n 1236,\n 1058,\n 1204,\n 927,\n 728,\n 486,\n 383,\n 381,\n 317,\n 340\n ],\n \"SKU_Premium\": [\n 156,\n 154,\n 150,\n 165,\n 238,\n 287,\n 337,\n 491,\n 618,\n 631,\n 637,\n 546,\n 610,\n 386,\n 340,\n 287,\n 193,\n 163,\n 163,\n 170\n ],\n \"SKU_ShortLife\": [\n 127,\n 126,\n 132,\n 166,\n 176,\n 199,\n 265,\n 376,\n 473,\n 519,\n 502,\n 454,\n 403,\n 354,\n 261,\n 238,\n 163,\n 152,\n 139,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_supply_bottleneck_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\": 1100171.654473379, \"DC2\": 1095657.8622260948, \"DC3\": 1084235.3355647023, \"DC4\": 975199.3968462343, \"DC5\": 1018455.8155221663}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0, 240.0], \"SKU_Premium\": [120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0, 120.0], \"SKU_ShortLife\": [150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0]}, \"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\": [294, 344, 338, 333, 418, 611, 693, 779, 1069, 1407, 1236, 1058, 1204, 927, 728, 486, 383, 381, 317, 340], \"SKU_Premium\": [156, 154, 150, 165, 238, 287, 337, 491, 618, 631, 637, 546, 610, 386, 340, 287, 193, 163, 163, 170], \"SKU_ShortLife\": [127, 126, 132, 166, 176, 199, 265, 376, 473, 519, 502, 454, 403, 354, 261, 238, 163, 152, 139, 116]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1009032.0} {"scenario_id": "retail_f3_unbalanced_network_v0", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_unbalanced_network_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 15360.0,\n \"DC2\": 160.0,\n \"DC3\": 160.0,\n \"DC4\": 160.0,\n \"DC5\": 160.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_unbalanced_network_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\": 15360.0, \"DC2\": 160.0, \"DC3\": 160.0, \"DC4\": 160.0, \"DC5\": 160.0}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 735284.93} {"scenario_id": "retail_f3_unbalanced_network_v1", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_unbalanced_network_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 16389.784391040364,\n \"DC2\": 144.57522575120956,\n \"DC3\": 147.24246404591747,\n \"DC4\": 137.8978360879057,\n \"DC5\": 171.46237064937515\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 290,\n 314,\n 288,\n 402,\n 418,\n 512,\n 636,\n 838,\n 1248,\n 1341,\n 1275,\n 1258,\n 1033,\n 782,\n 658,\n 556,\n 424,\n 361,\n 300,\n 315\n ],\n \"SKU_Premium\": [\n 135,\n 133,\n 141,\n 171,\n 244,\n 306,\n 376,\n 414,\n 609,\n 620,\n 585,\n 533,\n 530,\n 506,\n 307,\n 291,\n 189,\n 191,\n 153,\n 147\n ],\n \"SKU_ShortLife\": [\n 138,\n 125,\n 131,\n 153,\n 169,\n 242,\n 292,\n 329,\n 439,\n 524,\n 474,\n 472,\n 441,\n 390,\n 247,\n 228,\n 190,\n 130,\n 112,\n 137\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_unbalanced_network_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\": 16389.784391040364, \"DC2\": 144.57522575120956, \"DC3\": 147.24246404591747, \"DC4\": 137.8978360879057, \"DC5\": 171.46237064937515}, \"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\": [290, 314, 288, 402, 418, 512, 636, 838, 1248, 1341, 1275, 1258, 1033, 782, 658, 556, 424, 361, 300, 315], \"SKU_Premium\": [135, 133, 141, 171, 244, 306, 376, 414, 609, 620, 585, 533, 530, 506, 307, 291, 189, 191, 153, 147], \"SKU_ShortLife\": [138, 125, 131, 153, 169, 242, 292, 329, 439, 524, 474, 472, 441, 390, 247, 228, 190, 130, 112, 137]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 739353.78} {"scenario_id": "retail_f3_unbalanced_network_v2", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_unbalanced_network_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 13769.355971074652,\n \"DC2\": 149.77059259913372,\n \"DC3\": 144.0730334676832,\n \"DC4\": 149.18431787774554,\n \"DC5\": 166.26127542067172\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 298,\n 296,\n 348,\n 363,\n 464,\n 617,\n 644,\n 949,\n 1250,\n 1232,\n 1235,\n 1363,\n 1209,\n 845,\n 715,\n 474,\n 396,\n 416,\n 325,\n 319\n ],\n \"SKU_Premium\": [\n 133,\n 162,\n 167,\n 208,\n 200,\n 281,\n 361,\n 459,\n 535,\n 625,\n 731,\n 617,\n 608,\n 425,\n 364,\n 303,\n 189,\n 162,\n 163,\n 137\n ],\n \"SKU_ShortLife\": [\n 137,\n 126,\n 129,\n 124,\n 193,\n 212,\n 245,\n 309,\n 484,\n 540,\n 574,\n 447,\n 467,\n 402,\n 308,\n 187,\n 198,\n 164,\n 131,\n 109\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_unbalanced_network_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\": 13769.355971074652, \"DC2\": 149.77059259913372, \"DC3\": 144.0730334676832, \"DC4\": 149.18431787774554, \"DC5\": 166.26127542067172}, \"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\": [298, 296, 348, 363, 464, 617, 644, 949, 1250, 1232, 1235, 1363, 1209, 845, 715, 474, 396, 416, 325, 319], \"SKU_Premium\": [133, 162, 167, 208, 200, 281, 361, 459, 535, 625, 731, 617, 608, 425, 364, 303, 189, 162, 163, 137], \"SKU_ShortLife\": [137, 126, 129, 124, 193, 212, 245, 309, 484, 540, 574, 447, 467, 402, 308, 187, 198, 164, 131, 109]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 771200.16} {"scenario_id": "retail_f3_unbalanced_network_v3", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_unbalanced_network_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 14761.272810283635,\n \"DC2\": 180.588723830699,\n \"DC3\": 160.22303538972722,\n \"DC4\": 177.76422370924027,\n \"DC5\": 169.45876027788506\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 311,\n 275,\n 321,\n 324,\n 374,\n 631,\n 623,\n 873,\n 1171,\n 1292,\n 1356,\n 1422,\n 1223,\n 796,\n 743,\n 571,\n 482,\n 334,\n 356,\n 283\n ],\n \"SKU_Premium\": [\n 165,\n 133,\n 154,\n 174,\n 188,\n 271,\n 390,\n 443,\n 595,\n 538,\n 568,\n 557,\n 520,\n 478,\n 339,\n 310,\n 240,\n 199,\n 182,\n 142\n ],\n \"SKU_ShortLife\": [\n 126,\n 105,\n 113,\n 159,\n 191,\n 213,\n 250,\n 413,\n 445,\n 511,\n 467,\n 504,\n 384,\n 372,\n 266,\n 218,\n 161,\n 155,\n 139,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_unbalanced_network_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\": 14761.272810283635, \"DC2\": 180.588723830699, \"DC3\": 160.22303538972722, \"DC4\": 177.76422370924027, \"DC5\": 169.45876027788506}, \"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\": [311, 275, 321, 324, 374, 631, 623, 873, 1171, 1292, 1356, 1422, 1223, 796, 743, 571, 482, 334, 356, 283], \"SKU_Premium\": [165, 133, 154, 174, 188, 271, 390, 443, 595, 538, 568, 557, 520, 478, 339, 310, 240, 199, 182, 142], \"SKU_ShortLife\": [126, 105, 113, 159, 191, 213, 250, 413, 445, 511, 467, 504, 384, 372, 266, 218, 161, 155, 139, 130]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 714169.2} {"scenario_id": "retail_f3_unbalanced_network_v4", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_unbalanced_network\nScenario ID: retail_f3_unbalanced_network_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is highly unbalanced across locations. One location acts as a high-capacity hub with ample space, while all other locations have very limited storage. Demand is still local to each location, and there is no movement of inventory between locations. The retailer must decide how much to store at each site given these asymmetric capacity limits.\n\nStructure cues:\n- The inventory system remains single-echelon with local demand at each location and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. The JSON concentrates storage capacity at one hub location and gives very small capacities to the satellites.\n- Inventory for each product and location evolves from previous stock and local production, minus sales and waste, without ever going below zero.\n- Production capacities, zero lead times, and substitution behavior are as in the base scenario.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the highly asymmetric storage limits across locations.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_unbalanced_network_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 14412.151874089117,\n \"DC2\": 173.1692842982701,\n \"DC3\": 174.5411583707828,\n \"DC4\": 148.6420766336367,\n \"DC5\": 182.22021083391184\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 342,\n 285,\n 292,\n 360,\n 469,\n 547,\n 788,\n 798,\n 943,\n 1429,\n 1193,\n 1146,\n 1152,\n 793,\n 626,\n 557,\n 440,\n 361,\n 287,\n 265\n ],\n \"SKU_Premium\": [\n 163,\n 158,\n 144,\n 164,\n 192,\n 281,\n 305,\n 411,\n 470,\n 612,\n 696,\n 593,\n 508,\n 489,\n 326,\n 298,\n 239,\n 197,\n 153,\n 140\n ],\n \"SKU_ShortLife\": [\n 109,\n 105,\n 112,\n 130,\n 196,\n 207,\n 317,\n 399,\n 475,\n 482,\n 523,\n 486,\n 456,\n 375,\n 247,\n 209,\n 165,\n 152,\n 130,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_unbalanced_network_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\": 14412.151874089117, \"DC2\": 173.1692842982701, \"DC3\": 174.5411583707828, \"DC4\": 148.6420766336367, \"DC5\": 182.22021083391184}, \"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\": [342, 285, 292, 360, 469, 547, 788, 798, 943, 1429, 1193, 1146, 1152, 793, 626, 557, 440, 361, 287, 265], \"SKU_Premium\": [163, 158, 144, 164, 192, 281, 305, 411, 470, 612, 696, 593, 508, 489, 326, 298, 239, 197, 153, 140], \"SKU_ShortLife\": [109, 105, 112, 130, 196, 207, 317, 399, 475, 482, 523, 486, 456, 375, 247, 209, 165, 152, 130, 116]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 693650.01} {"scenario_id": "retail_f3_volumetric_constraint_v0", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_volumetric_constraint_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 15.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_volumetric_constraint_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\": 15.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 409419.62} {"scenario_id": "retail_f3_volumetric_constraint_v1", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_volumetric_constraint_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4408.72627642685,\n \"DC2\": 3667.439800340886,\n \"DC3\": 3140.886796114431,\n \"DC4\": 3377.991537212454,\n \"DC5\": 2597.040290953764\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 15.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 294,\n 271,\n 376,\n 355,\n 492,\n 488,\n 689,\n 879,\n 1126,\n 1376,\n 1222,\n 1256,\n 1173,\n 1021,\n 755,\n 583,\n 425,\n 399,\n 324,\n 299\n ],\n \"SKU_Premium\": [\n 169,\n 144,\n 159,\n 170,\n 221,\n 257,\n 314,\n 486,\n 469,\n 644,\n 695,\n 628,\n 567,\n 503,\n 307,\n 287,\n 199,\n 158,\n 155,\n 137\n ],\n \"SKU_ShortLife\": [\n 126,\n 129,\n 111,\n 139,\n 167,\n 225,\n 253,\n 373,\n 472,\n 456,\n 530,\n 543,\n 390,\n 319,\n 278,\n 193,\n 165,\n 160,\n 124,\n 115\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_volumetric_constraint_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\": 4408.72627642685, \"DC2\": 3667.439800340886, \"DC3\": 3140.886796114431, \"DC4\": 3377.991537212454, \"DC5\": 2597.040290953764}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 15.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\": [294, 271, 376, 355, 492, 488, 689, 879, 1126, 1376, 1222, 1256, 1173, 1021, 755, 583, 425, 399, 324, 299], \"SKU_Premium\": [169, 144, 159, 170, 221, 257, 314, 486, 469, 644, 695, 628, 567, 503, 307, 287, 199, 158, 155, 137], \"SKU_ShortLife\": [126, 129, 111, 139, 167, 225, 253, 373, 472, 456, 530, 543, 390, 319, 278, 193, 165, 160, 124, 115]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 414093.56} {"scenario_id": "retail_f3_volumetric_constraint_v2", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_volumetric_constraint_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3406.179071113192,\n \"DC2\": 3048.861714569209,\n \"DC3\": 2894.369002627237,\n \"DC4\": 2568.1215645149905,\n \"DC5\": 2303.0678179461047\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 15.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 284,\n 278,\n 357,\n 319,\n 475,\n 614,\n 814,\n 839,\n 996,\n 1344,\n 1288,\n 1246,\n 969,\n 899,\n 804,\n 493,\n 445,\n 314,\n 333,\n 319\n ],\n \"SKU_Premium\": [\n 137,\n 140,\n 163,\n 183,\n 248,\n 278,\n 360,\n 390,\n 495,\n 665,\n 737,\n 543,\n 500,\n 429,\n 342,\n 271,\n 227,\n 189,\n 149,\n 153\n ],\n \"SKU_ShortLife\": [\n 108,\n 130,\n 119,\n 146,\n 194,\n 212,\n 296,\n 373,\n 473,\n 471,\n 579,\n 491,\n 403,\n 317,\n 257,\n 219,\n 160,\n 145,\n 127,\n 135\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_volumetric_constraint_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\": 3406.179071113192, \"DC2\": 3048.861714569209, \"DC3\": 2894.369002627237, \"DC4\": 2568.1215645149905, \"DC5\": 2303.0678179461047}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 15.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\": [284, 278, 357, 319, 475, 614, 814, 839, 996, 1344, 1288, 1246, 969, 899, 804, 493, 445, 314, 333, 319], \"SKU_Premium\": [137, 140, 163, 183, 248, 278, 360, 390, 495, 665, 737, 543, 500, 429, 342, 271, 227, 189, 149, 153], \"SKU_ShortLife\": [108, 130, 119, 146, 194, 212, 296, 373, 473, 471, 579, 491, 403, 317, 257, 219, 160, 145, 127, 135]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 402309.0} {"scenario_id": "retail_f3_volumetric_constraint_v3", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_volumetric_constraint_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3908.8086755208647,\n \"DC2\": 3666.698399375343,\n \"DC3\": 3350.9437816388095,\n \"DC4\": 3187.328873088867,\n \"DC5\": 2699.649372855567\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 15.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 316,\n 294,\n 306,\n 414,\n 380,\n 495,\n 621,\n 1035,\n 981,\n 1161,\n 1304,\n 1330,\n 1181,\n 885,\n 631,\n 582,\n 450,\n 409,\n 334,\n 317\n ],\n \"SKU_Premium\": [\n 131,\n 165,\n 142,\n 196,\n 199,\n 272,\n 308,\n 510,\n 545,\n 714,\n 612,\n 563,\n 504,\n 402,\n 348,\n 257,\n 200,\n 204,\n 166,\n 153\n ],\n \"SKU_ShortLife\": [\n 106,\n 113,\n 142,\n 143,\n 167,\n 214,\n 244,\n 336,\n 495,\n 519,\n 581,\n 466,\n 375,\n 415,\n 295,\n 199,\n 190,\n 151,\n 119,\n 109\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_volumetric_constraint_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\": 3908.8086755208647, \"DC2\": 3666.698399375343, \"DC3\": 3350.9437816388095, \"DC4\": 3187.328873088867, \"DC5\": 2699.649372855567}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 15.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, 294, 306, 414, 380, 495, 621, 1035, 981, 1161, 1304, 1330, 1181, 885, 631, 582, 450, 409, 334, 317], \"SKU_Premium\": [131, 165, 142, 196, 199, 272, 308, 510, 545, 714, 612, 563, 504, 402, 348, 257, 200, 204, 166, 153], \"SKU_ShortLife\": [106, 113, 142, 143, 167, 214, 244, 336, 495, 519, 581, 466, 375, 415, 295, 199, 190, 151, 119, 109]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 399819.62} {"scenario_id": "retail_f3_volumetric_constraint_v4", "prompt_schema": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F3 (Shared Resources and Capacity)\nArchetype: retail_f3_volumetric_constraint\nScenario ID: retail_f3_volumetric_constraint_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOne product -- typically a bulky premium item -- uses much more storage volume per unit than the others. Storage capacity at each location becomes tight primarily because of this product, forcing the retailer to choose between stocking bulky high-margin units and smaller items. All demand remains local and exogenous, with no transshipment or backorders.\n\nStructure cues:\n- The overall structure and shared storage framework match retail_f3_storage_bottleneck.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Product-specific storage usage parameters in the JSON are much larger for the premium product than for other SKUs.\n- Inventory cannot be negative and is updated based on previous stock, local production, sales, and waste.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph with standard semantics.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) under capacity constraints that make the volumetrically heavy premium product particularly expensive in terms of space.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f3_volumetric_constraint_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3856.209407179451,\n \"DC2\": 3798.723085114051,\n \"DC3\": 2628.0429516606355,\n \"DC4\": 3092.571454223831,\n \"DC5\": 2701.5171856724796\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 15.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 322,\n 330,\n 356,\n 373,\n 393,\n 571,\n 615,\n 825,\n 951,\n 1189,\n 1367,\n 1151,\n 1026,\n 835,\n 737,\n 479,\n 381,\n 352,\n 335,\n 322\n ],\n \"SKU_Premium\": [\n 143,\n 160,\n 157,\n 158,\n 229,\n 248,\n 345,\n 386,\n 604,\n 710,\n 726,\n 533,\n 481,\n 516,\n 402,\n 255,\n 248,\n 164,\n 165,\n 145\n ],\n \"SKU_ShortLife\": [\n 133,\n 132,\n 131,\n 136,\n 162,\n 194,\n 247,\n 392,\n 378,\n 460,\n 460,\n 553,\n 383,\n 387,\n 303,\n 208,\n 182,\n 145,\n 131,\n 113\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f3_volumetric_constraint_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\": 3856.209407179451, \"DC2\": 3798.723085114051, \"DC3\": 2628.0429516606355, \"DC4\": 3092.571454223831, \"DC5\": 2701.5171856724796}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 15.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\": [322, 330, 356, 373, 393, 571, 615, 825, 951, 1189, 1367, 1151, 1026, 835, 737, 479, 381, 352, 335, 322], \"SKU_Premium\": [143, 160, 157, 158, 229, 248, 345, 386, 604, 710, 726, 533, 481, 516, 402, 255, 248, 164, 165, 145], \"SKU_ShortLife\": [133, 132, 131, 136, 162, 194, 247, 392, 378, 460, 460, 553, 383, 387, 303, 208, 182, 145, 131, 113]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 399408.82} {"scenario_id": "retail_f4_demand_surge_v0", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_demand_surge_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 2844,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 1420,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 1136,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_demand_surge_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, 2844, 549, 435, 365, 328, 311], \"SKU_Premium\": [151, 155, 164, 182, 217, 274, 355, 453, 550, 622, 650, 622, 550, 453, 1420, 274, 217, 182, 164, 155], \"SKU_ShortLife\": [121, 124, 131, 146, 174, 219, 284, 362, 440, 498, 520, 498, 440, 362, 1136, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 562717.5} {"scenario_id": "retail_f4_demand_surge_v1", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_demand_surge_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3402.049614362719,\n \"DC2\": 3601.0137027081646,\n \"DC3\": 3079.9458330278408,\n \"DC4\": 3367.5100616585687,\n \"DC5\": 2373.1356267711126\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 285,\n 348,\n 340,\n 316,\n 395,\n 540,\n 795,\n 1029,\n 1254,\n 1405,\n 1246,\n 1095,\n 1078,\n 795,\n 3200,\n 623,\n 444,\n 339,\n 340,\n 312\n ],\n \"SKU_Premium\": [\n 153,\n 156,\n 158,\n 196,\n 232,\n 263,\n 344,\n 492,\n 598,\n 635,\n 675,\n 564,\n 556,\n 388,\n 1529,\n 249,\n 222,\n 162,\n 176,\n 172\n ],\n \"SKU_ShortLife\": [\n 107,\n 111,\n 129,\n 129,\n 196,\n 223,\n 283,\n 374,\n 505,\n 456,\n 591,\n 464,\n 503,\n 388,\n 1082,\n 243,\n 158,\n 162,\n 148,\n 128\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_demand_surge_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\": 3402.049614362719, \"DC2\": 3601.0137027081646, \"DC3\": 3079.9458330278408, \"DC4\": 3367.5100616585687, \"DC5\": 2373.1356267711126}, \"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\": [285, 348, 340, 316, 395, 540, 795, 1029, 1254, 1405, 1246, 1095, 1078, 795, 3200, 623, 444, 339, 340, 312], \"SKU_Premium\": [153, 156, 158, 196, 232, 263, 344, 492, 598, 635, 675, 564, 556, 388, 1529, 249, 222, 162, 176, 172], \"SKU_ShortLife\": [107, 111, 129, 129, 196, 223, 283, 374, 505, 456, 591, 464, 503, 388, 1082, 243, 158, 162, 148, 128]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 596190.0} {"scenario_id": "retail_f4_demand_surge_v2", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_demand_surge_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3819.945865685423,\n \"DC2\": 3609.9362252451174,\n \"DC3\": 3185.7109811662085,\n \"DC4\": 3387.014925133641,\n \"DC5\": 2300.786190660187\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 297,\n 306,\n 348,\n 417,\n 416,\n 526,\n 645,\n 871,\n 1162,\n 1062,\n 1275,\n 1416,\n 1228,\n 796,\n 3191,\n 580,\n 493,\n 366,\n 358,\n 351\n ],\n \"SKU_Premium\": [\n 171,\n 138,\n 150,\n 170,\n 233,\n 301,\n 324,\n 406,\n 537,\n 663,\n 711,\n 550,\n 495,\n 398,\n 1267,\n 252,\n 190,\n 169,\n 173,\n 176\n ],\n \"SKU_ShortLife\": [\n 118,\n 131,\n 135,\n 152,\n 174,\n 208,\n 286,\n 326,\n 434,\n 443,\n 551,\n 484,\n 475,\n 340,\n 1222,\n 193,\n 154,\n 155,\n 121,\n 108\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_demand_surge_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\": 3819.945865685423, \"DC2\": 3609.9362252451174, \"DC3\": 3185.7109811662085, \"DC4\": 3387.014925133641, \"DC5\": 2300.786190660187}, \"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\": [297, 306, 348, 417, 416, 526, 645, 871, 1162, 1062, 1275, 1416, 1228, 796, 3191, 580, 493, 366, 358, 351], \"SKU_Premium\": [171, 138, 150, 170, 233, 301, 324, 406, 537, 663, 711, 550, 495, 398, 1267, 252, 190, 169, 173, 176], \"SKU_ShortLife\": [118, 131, 135, 152, 174, 208, 286, 326, 434, 443, 551, 484, 475, 340, 1222, 193, 154, 155, 121, 108]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 555907.0} {"scenario_id": "retail_f4_demand_surge_v3", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_demand_surge_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3428.7738365410414,\n \"DC2\": 3550.439767792903,\n \"DC3\": 3179.3554972854326,\n \"DC4\": 3143.953222784597,\n \"DC5\": 2568.592625321386\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 293,\n 280,\n 366,\n 371,\n 388,\n 543,\n 660,\n 872,\n 1023,\n 1265,\n 1151,\n 1315,\n 1042,\n 1031,\n 2972,\n 523,\n 424,\n 312,\n 313,\n 306\n ],\n \"SKU_Premium\": [\n 137,\n 178,\n 183,\n 194,\n 213,\n 306,\n 367,\n 429,\n 503,\n 701,\n 620,\n 669,\n 615,\n 426,\n 1572,\n 302,\n 235,\n 191,\n 181,\n 142\n ],\n \"SKU_ShortLife\": [\n 107,\n 116,\n 114,\n 143,\n 167,\n 199,\n 270,\n 308,\n 396,\n 547,\n 516,\n 554,\n 451,\n 412,\n 1202,\n 244,\n 174,\n 137,\n 130,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_demand_surge_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\": 3428.7738365410414, \"DC2\": 3550.439767792903, \"DC3\": 3179.3554972854326, \"DC4\": 3143.953222784597, \"DC5\": 2568.592625321386}, \"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\": [293, 280, 366, 371, 388, 543, 660, 872, 1023, 1265, 1151, 1315, 1042, 1031, 2972, 523, 424, 312, 313, 306], \"SKU_Premium\": [137, 178, 183, 194, 213, 306, 367, 429, 503, 701, 620, 669, 615, 426, 1572, 302, 235, 191, 181, 142], \"SKU_ShortLife\": [107, 116, 114, 143, 167, 199, 270, 308, 396, 547, 516, 554, 451, 412, 1202, 244, 174, 137, 130, 130]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 585562.5} {"scenario_id": "retail_f4_demand_surge_v4", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_demand_surge\nScenario ID: retail_f4_demand_surge_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences a single-period viral demand spike where demand suddenly multiplies for all products. Production capacity and other structural elements remain unchanged; only the magnitude of demand in that period is much higher. The retailer must decide whether to build extra inventory in advance or accept lost sales during the surge.\n\nStructure cues:\n- The inventory and production structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, one mid-horizon period has demand for each product scaled up by a large factor, representing the surge. This period is treated as having much higher exogenous demand.\n- Inventory stays non-negative and is updated using previous stock, current production, sales, and waste.\n- Substitution behavior is unchanged, there is no transshipment, and lead times remain effectively zero.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), with the demand spike increasing the importance of planning ahead for that particular period.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_demand_surge_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3626.2266666772134,\n \"DC2\": 3203.9969463048124,\n \"DC3\": 2770.76224849127,\n \"DC4\": 3030.909280245911,\n \"DC5\": 2715.192803182658\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 311,\n 338,\n 350,\n 331,\n 469,\n 509,\n 748,\n 778,\n 1041,\n 1224,\n 1145,\n 1318,\n 1169,\n 1018,\n 3163,\n 562,\n 402,\n 384,\n 290,\n 295\n ],\n \"SKU_Premium\": [\n 159,\n 172,\n 164,\n 156,\n 226,\n 252,\n 334,\n 402,\n 548,\n 568,\n 665,\n 620,\n 477,\n 450,\n 1631,\n 237,\n 212,\n 184,\n 143,\n 159\n ],\n \"SKU_ShortLife\": [\n 114,\n 108,\n 123,\n 136,\n 193,\n 223,\n 306,\n 353,\n 450,\n 564,\n 556,\n 483,\n 486,\n 323,\n 983,\n 239,\n 181,\n 135,\n 120,\n 114\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_demand_surge_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\": 3626.2266666772134, \"DC2\": 3203.9969463048124, \"DC3\": 2770.76224849127, \"DC4\": 3030.909280245911, \"DC5\": 2715.192803182658}, \"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\": [311, 338, 350, 331, 469, 509, 748, 778, 1041, 1224, 1145, 1318, 1169, 1018, 3163, 562, 402, 384, 290, 295], \"SKU_Premium\": [159, 172, 164, 156, 226, 252, 334, 402, 548, 568, 665, 620, 477, 450, 1631, 237, 212, 184, 143, 159], \"SKU_ShortLife\": [114, 108, 123, 136, 193, 223, 306, 353, 450, 564, 556, 483, 486, 323, 983, 239, 181, 135, 120, 114]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 575165.0} {"scenario_id": "retail_f4_early_stockout_v0", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_early_stockout_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_early_stockout_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\": [0, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [0, 0, 0, 0, 0, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 621810.5} {"scenario_id": "retail_f4_early_stockout_v1", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_early_stockout_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3549.146998436031,\n \"DC2\": 3484.681415984728,\n \"DC3\": 2965.5892139513503,\n \"DC4\": 3134.8427347753077,\n \"DC5\": 2327.4432911690656\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 260,\n 290,\n 324,\n 381,\n 424,\n 609,\n 684,\n 857,\n 1176,\n 1085,\n 1136,\n 1331,\n 992,\n 783,\n 778,\n 539,\n 392,\n 364,\n 371,\n 312\n ],\n \"SKU_Premium\": [\n 142,\n 166,\n 159,\n 175,\n 203,\n 243,\n 315,\n 459,\n 516,\n 603,\n 658,\n 664,\n 532,\n 514,\n 318,\n 252,\n 205,\n 169,\n 175,\n 143\n ],\n \"SKU_ShortLife\": [\n 123,\n 142,\n 144,\n 166,\n 149,\n 219,\n 242,\n 356,\n 470,\n 536,\n 582,\n 534,\n 387,\n 322,\n 278,\n 247,\n 163,\n 140,\n 139,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_early_stockout_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\": 3549.146998436031, \"DC2\": 3484.681415984728, \"DC3\": 2965.5892139513503, \"DC4\": 3134.8427347753077, \"DC5\": 2327.4432911690656}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [0, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [0, 0, 0, 0, 0, 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\": [260, 290, 324, 381, 424, 609, 684, 857, 1176, 1085, 1136, 1331, 992, 783, 778, 539, 392, 364, 371, 312], \"SKU_Premium\": [142, 166, 159, 175, 203, 243, 315, 459, 516, 603, 658, 664, 532, 514, 318, 252, 205, 169, 175, 143], \"SKU_ShortLife\": [123, 142, 144, 166, 149, 219, 242, 356, 470, 536, 582, 534, 387, 322, 278, 247, 163, 140, 139, 130]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 596280.5} {"scenario_id": "retail_f4_early_stockout_v2", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_early_stockout_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4421.064669109754,\n \"DC2\": 3784.9443762579076,\n \"DC3\": 3295.183136103139,\n \"DC4\": 2765.1023047085446,\n \"DC5\": 2161.092015261721\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 302,\n 286,\n 358,\n 403,\n 468,\n 571,\n 616,\n 942,\n 1227,\n 1088,\n 1492,\n 1107,\n 1084,\n 1034,\n 770,\n 622,\n 492,\n 335,\n 309,\n 356\n ],\n \"SKU_Premium\": [\n 145,\n 160,\n 167,\n 198,\n 215,\n 312,\n 346,\n 465,\n 510,\n 667,\n 584,\n 573,\n 591,\n 419,\n 304,\n 236,\n 193,\n 156,\n 179,\n 153\n ],\n \"SKU_ShortLife\": [\n 135,\n 121,\n 119,\n 140,\n 190,\n 200,\n 265,\n 394,\n 495,\n 444,\n 560,\n 522,\n 497,\n 395,\n 300,\n 221,\n 157,\n 127,\n 129,\n 131\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_early_stockout_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\": 4421.064669109754, \"DC2\": 3784.9443762579076, \"DC3\": 3295.183136103139, \"DC4\": 2765.1023047085446, \"DC5\": 2161.092015261721}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [0, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [0, 0, 0, 0, 0, 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\": [302, 286, 358, 403, 468, 571, 616, 942, 1227, 1088, 1492, 1107, 1084, 1034, 770, 622, 492, 335, 309, 356], \"SKU_Premium\": [145, 160, 167, 198, 215, 312, 346, 465, 510, 667, 584, 573, 591, 419, 304, 236, 193, 156, 179, 153], \"SKU_ShortLife\": [135, 121, 119, 140, 190, 200, 265, 394, 495, 444, 560, 522, 497, 395, 300, 221, 157, 127, 129, 131]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 628599.5} {"scenario_id": "retail_f4_early_stockout_v3", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_early_stockout_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4302.566094233799,\n \"DC2\": 3992.79581524138,\n \"DC3\": 2920.988690935649,\n \"DC4\": 2889.8701602545884,\n \"DC5\": 2678.3134583400038\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 267,\n 303,\n 307,\n 417,\n 487,\n 517,\n 639,\n 949,\n 1176,\n 1336,\n 1190,\n 1314,\n 1240,\n 892,\n 691,\n 625,\n 442,\n 353,\n 360,\n 307\n ],\n \"SKU_Premium\": [\n 172,\n 174,\n 148,\n 188,\n 228,\n 297,\n 319,\n 470,\n 500,\n 628,\n 645,\n 565,\n 533,\n 407,\n 351,\n 280,\n 224,\n 162,\n 166,\n 133\n ],\n \"SKU_ShortLife\": [\n 103,\n 107,\n 137,\n 141,\n 165,\n 235,\n 305,\n 325,\n 473,\n 463,\n 523,\n 455,\n 394,\n 337,\n 313,\n 235,\n 199,\n 162,\n 140,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_early_stockout_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\": 4302.566094233799, \"DC2\": 3992.79581524138, \"DC3\": 2920.988690935649, \"DC4\": 2889.8701602545884, \"DC5\": 2678.3134583400038}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [0, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [0, 0, 0, 0, 0, 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\": [267, 303, 307, 417, 487, 517, 639, 949, 1176, 1336, 1190, 1314, 1240, 892, 691, 625, 442, 353, 360, 307], \"SKU_Premium\": [172, 174, 148, 188, 228, 297, 319, 470, 500, 628, 645, 565, 533, 407, 351, 280, 224, 162, 166, 133], \"SKU_ShortLife\": [103, 107, 137, 141, 165, 235, 305, 325, 473, 463, 523, 455, 394, 337, 313, 235, 199, 162, 140, 119]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 621677.5} {"scenario_id": "retail_f4_early_stockout_v4", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_early_stockout\nScenario ID: retail_f4_early_stockout_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer experiences an upstream supply failure at launch. For several initial periods, no production is possible for any product, but customer demand already exists at the locations. The retailer must decide how much inventory to build before the disruption and how to ration demand while supply is temporarily unavailable. Unserved demand in the disruption window is lost and penalized; customers are not backordered.\n\nStructure cues:\n- The inventory, storage, and lost sales framework matches the base scenario: single-echelon, local inventories, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacity for all products is set to zero in early periods. The model must respect this by not assigning any new production in those periods.\n- Inventory remains non-negative and changes from period to period based on previous stock, any allowed production (zero during the disruption), sales, and waste.\n- Substitution behavior and zero lead times remain unchanged from the baseline.\n- Labor capacity is generous and does not bind.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the trade-off between carrying inventory into the supply failure and accepting lost sales during the disruption.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_early_stockout_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4171.280555421592,\n \"DC2\": 3917.0279714433823,\n \"DC3\": 3234.4142932396585,\n \"DC4\": 3071.2972056767253,\n \"DC5\": 2229.278578700469\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 315,\n 284,\n 294,\n 368,\n 455,\n 510,\n 612,\n 1034,\n 1009,\n 1380,\n 1416,\n 1165,\n 1102,\n 887,\n 674,\n 549,\n 426,\n 312,\n 311,\n 278\n ],\n \"SKU_Premium\": [\n 153,\n 176,\n 154,\n 171,\n 242,\n 263,\n 326,\n 407,\n 507,\n 695,\n 645,\n 645,\n 509,\n 478,\n 354,\n 279,\n 221,\n 208,\n 177,\n 164\n ],\n \"SKU_ShortLife\": [\n 124,\n 106,\n 131,\n 148,\n 153,\n 212,\n 256,\n 388,\n 392,\n 426,\n 562,\n 569,\n 472,\n 316,\n 308,\n 232,\n 153,\n 160,\n 140,\n 127\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_early_stockout_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\": 4171.280555421592, \"DC2\": 3917.0279714433823, \"DC3\": 3234.4142932396585, \"DC4\": 3071.2972056767253, \"DC5\": 2229.278578700469}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [0, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [0, 0, 0, 0, 0, 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\": [315, 284, 294, 368, 455, 510, 612, 1034, 1009, 1380, 1416, 1165, 1102, 887, 674, 549, 426, 312, 311, 278], \"SKU_Premium\": [153, 176, 154, 171, 242, 263, 326, 407, 507, 695, 645, 645, 509, 478, 354, 279, 221, 208, 177, 164], \"SKU_ShortLife\": [124, 106, 131, 148, 153, 212, 256, 388, 392, 426, 562, 569, 472, 316, 308, 232, 153, 160, 140, 127]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 620242.5} {"scenario_id": "retail_f4_peak_failure_v0", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_peak_failure_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_peak_failure_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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 595032.0} {"scenario_id": "retail_f4_peak_failure_v1", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_peak_failure_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3842.963505762114,\n \"DC2\": 3032.539626957944,\n \"DC3\": 3307.966758582875,\n \"DC4\": 3172.0214228509362,\n \"DC5\": 2128.572036245721\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 305,\n 288,\n 309,\n 358,\n 398,\n 497,\n 664,\n 838,\n 994,\n 1189,\n 1278,\n 1063,\n 943,\n 921,\n 769,\n 592,\n 430,\n 379,\n 318,\n 285\n ],\n \"SKU_Premium\": [\n 147,\n 132,\n 152,\n 166,\n 196,\n 288,\n 372,\n 393,\n 612,\n 699,\n 571,\n 632,\n 533,\n 387,\n 355,\n 250,\n 210,\n 197,\n 140,\n 143\n ],\n \"SKU_ShortLife\": [\n 132,\n 124,\n 135,\n 162,\n 177,\n 236,\n 264,\n 413,\n 421,\n 568,\n 579,\n 457,\n 489,\n 366,\n 264,\n 227,\n 157,\n 157,\n 149,\n 107\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_peak_failure_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\": 3842.963505762114, \"DC2\": 3032.539626957944, \"DC3\": 3307.966758582875, \"DC4\": 3172.0214228509362, \"DC5\": 2128.572036245721}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [305, 288, 309, 358, 398, 497, 664, 838, 994, 1189, 1278, 1063, 943, 921, 769, 592, 430, 379, 318, 285], \"SKU_Premium\": [147, 132, 152, 166, 196, 288, 372, 393, 612, 699, 571, 632, 533, 387, 355, 250, 210, 197, 140, 143], \"SKU_ShortLife\": [132, 124, 135, 162, 177, 236, 264, 413, 421, 568, 579, 457, 489, 366, 264, 227, 157, 157, 149, 107]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 554930.0} {"scenario_id": "retail_f4_peak_failure_v2", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_peak_failure_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3684.5687806779442,\n \"DC2\": 3977.9533970885395,\n \"DC3\": 3294.8471264216587,\n \"DC4\": 3430.7165966846187,\n \"DC5\": 2308.8008948741203\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 288,\n 268,\n 340,\n 388,\n 457,\n 571,\n 769,\n 986,\n 1024,\n 1341,\n 1454,\n 1143,\n 957,\n 880,\n 626,\n 488,\n 466,\n 367,\n 323,\n 295\n ],\n \"SKU_Premium\": [\n 137,\n 143,\n 173,\n 201,\n 203,\n 256,\n 387,\n 414,\n 575,\n 635,\n 701,\n 528,\n 581,\n 459,\n 354,\n 291,\n 185,\n 177,\n 171,\n 136\n ],\n \"SKU_ShortLife\": [\n 109,\n 140,\n 144,\n 144,\n 167,\n 189,\n 249,\n 376,\n 413,\n 512,\n 585,\n 467,\n 483,\n 374,\n 253,\n 207,\n 166,\n 132,\n 142,\n 123\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_peak_failure_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\": 3684.5687806779442, \"DC2\": 3977.9533970885395, \"DC3\": 3294.8471264216587, \"DC4\": 3430.7165966846187, \"DC5\": 2308.8008948741203}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [288, 268, 340, 388, 457, 571, 769, 986, 1024, 1341, 1454, 1143, 957, 880, 626, 488, 466, 367, 323, 295], \"SKU_Premium\": [137, 143, 173, 201, 203, 256, 387, 414, 575, 635, 701, 528, 581, 459, 354, 291, 185, 177, 171, 136], \"SKU_ShortLife\": [109, 140, 144, 144, 167, 189, 249, 376, 413, 512, 585, 467, 483, 374, 253, 207, 166, 132, 142, 123]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 596084.5} {"scenario_id": "retail_f4_peak_failure_v3", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_peak_failure_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4188.234877286609,\n \"DC2\": 3464.5118846516402,\n \"DC3\": 2988.5493969225336,\n \"DC4\": 2953.3808573936462,\n \"DC5\": 2434.665825536948\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 310,\n 342,\n 298,\n 338,\n 388,\n 569,\n 703,\n 871,\n 1225,\n 1152,\n 1412,\n 1162,\n 1124,\n 998,\n 800,\n 629,\n 404,\n 402,\n 360,\n 310\n ],\n \"SKU_Premium\": [\n 161,\n 171,\n 157,\n 187,\n 214,\n 262,\n 327,\n 484,\n 511,\n 559,\n 719,\n 541,\n 489,\n 431,\n 364,\n 307,\n 246,\n 162,\n 145,\n 169\n ],\n \"SKU_ShortLife\": [\n 121,\n 120,\n 134,\n 165,\n 156,\n 194,\n 257,\n 308,\n 401,\n 503,\n 493,\n 514,\n 473,\n 353,\n 281,\n 247,\n 158,\n 153,\n 112,\n 132\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_peak_failure_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\": 4188.234877286609, \"DC2\": 3464.5118846516402, \"DC3\": 2988.5493969225336, \"DC4\": 2953.3808573936462, \"DC5\": 2434.665825536948}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [310, 342, 298, 338, 388, 569, 703, 871, 1225, 1152, 1412, 1162, 1124, 998, 800, 629, 404, 402, 360, 310], \"SKU_Premium\": [161, 171, 157, 187, 214, 262, 327, 484, 511, 559, 719, 541, 489, 431, 364, 307, 246, 162, 145, 169], \"SKU_ShortLife\": [121, 120, 134, 165, 156, 194, 257, 308, 401, 503, 493, 514, 473, 353, 281, 247, 158, 153, 112, 132]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 585244.5} {"scenario_id": "retail_f4_peak_failure_v4", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_peak_failure\nScenario ID: retail_f4_peak_failure_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nAn upstream supply failure occurs during a high-demand peak, such as a holiday season. Production capacity drops to zero only during the peak window, while demand for all products remains high. The retailer must build inventory before the peak, use it strategically during the failure, and accept some lost sales if necessary. Demand that cannot be served in the peak periods is lost and penalized.\n\nStructure cues:\n- The inventory, storage, and lost sales structure is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, production capacities are set to zero only during a mid-horizon block of periods that coincide with the demand peak. No new production can occur in those periods.\n- Inventory at each location remains non-negative and is updated from period to period based on earlier production, sales, and waste.\n- Substitution behavior, absence of transshipment, zero lead times, and generous labor capacity all remain in effect.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while planning around the temporary but strategically placed supply failure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_peak_failure_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4451.845644718405,\n \"DC2\": 3925.6713814773,\n \"DC3\": 3057.9008382548413,\n \"DC4\": 3244.264987804345,\n \"DC5\": 2851.470849025485\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 274,\n 293,\n 348,\n 393,\n 495,\n 616,\n 675,\n 1040,\n 1182,\n 1221,\n 1435,\n 1352,\n 979,\n 999,\n 784,\n 559,\n 438,\n 385,\n 336,\n 283\n ],\n \"SKU_Premium\": [\n 130,\n 150,\n 168,\n 198,\n 239,\n 284,\n 311,\n 431,\n 605,\n 714,\n 676,\n 583,\n 533,\n 445,\n 318,\n 243,\n 205,\n 205,\n 162,\n 135\n ],\n \"SKU_ShortLife\": [\n 125,\n 128,\n 122,\n 148,\n 198,\n 244,\n 257,\n 374,\n 421,\n 458,\n 467,\n 471,\n 474,\n 412,\n 318,\n 191,\n 172,\n 138,\n 126,\n 138\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_peak_failure_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\": 4451.845644718405, \"DC2\": 3925.6713814773, \"DC3\": 3057.9008382548413, \"DC4\": 3244.264987804345, \"DC5\": 2851.470849025485}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [274, 293, 348, 393, 495, 616, 675, 1040, 1182, 1221, 1435, 1352, 979, 999, 784, 559, 438, 385, 336, 283], \"SKU_Premium\": [130, 150, 168, 198, 239, 284, 311, 431, 605, 714, 676, 583, 533, 445, 318, 243, 205, 205, 162, 135], \"SKU_ShortLife\": [125, 128, 122, 148, 198, 244, 257, 374, 421, 458, 467, 471, 474, 412, 318, 191, 172, 138, 126, 138]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 621889.5} {"scenario_id": "retail_f4_quality_hold_v0", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_quality_hold_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_quality_hold_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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 566687.5} {"scenario_id": "retail_f4_quality_hold_v1", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_quality_hold_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4037.457522743235,\n \"DC2\": 3858.434195054075,\n \"DC3\": 3111.000146727276,\n \"DC4\": 3387.56652945535,\n \"DC5\": 2839.6813587039137\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 328,\n 274,\n 347,\n 310,\n 380,\n 611,\n 792,\n 915,\n 1010,\n 1388,\n 1167,\n 1125,\n 1180,\n 918,\n 639,\n 487,\n 391,\n 318,\n 317,\n 311\n ],\n \"SKU_Premium\": [\n 159,\n 144,\n 186,\n 168,\n 212,\n 296,\n 305,\n 510,\n 616,\n 561,\n 562,\n 677,\n 585,\n 405,\n 333,\n 245,\n 201,\n 207,\n 186,\n 132\n ],\n \"SKU_ShortLife\": [\n 122,\n 119,\n 114,\n 142,\n 161,\n 232,\n 266,\n 352,\n 446,\n 555,\n 443,\n 435,\n 383,\n 414,\n 254,\n 248,\n 166,\n 150,\n 119,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_quality_hold_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\": 4037.457522743235, \"DC2\": 3858.434195054075, \"DC3\": 3111.000146727276, \"DC4\": 3387.56652945535, \"DC5\": 2839.6813587039137}, \"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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \"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\": [328, 274, 347, 310, 380, 611, 792, 915, 1010, 1388, 1167, 1125, 1180, 918, 639, 487, 391, 318, 317, 311], \"SKU_Premium\": [159, 144, 186, 168, 212, 296, 305, 510, 616, 561, 562, 677, 585, 405, 333, 245, 201, 207, 186, 132], \"SKU_ShortLife\": [122, 119, 114, 142, 161, 232, 266, 352, 446, 555, 443, 435, 383, 414, 254, 248, 166, 150, 119, 116]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 546510.5} {"scenario_id": "retail_f4_quality_hold_v2", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_quality_hold_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3719.324171623398,\n \"DC2\": 3451.9614334146313,\n \"DC3\": 2872.8961546203122,\n \"DC4\": 3001.786707072527,\n \"DC5\": 2810.787383672959\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 336,\n 321,\n 368,\n 348,\n 486,\n 615,\n 673,\n 849,\n 1023,\n 1375,\n 1266,\n 1161,\n 1014,\n 881,\n 775,\n 596,\n 415,\n 394,\n 350,\n 275\n ],\n \"SKU_Premium\": [\n 150,\n 133,\n 146,\n 172,\n 229,\n 302,\n 318,\n 503,\n 539,\n 622,\n 561,\n 591,\n 519,\n 463,\n 303,\n 276,\n 248,\n 200,\n 184,\n 171\n ],\n \"SKU_ShortLife\": [\n 129,\n 128,\n 132,\n 154,\n 170,\n 244,\n 247,\n 308,\n 398,\n 467,\n 447,\n 449,\n 395,\n 343,\n 321,\n 192,\n 188,\n 144,\n 116,\n 139\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_quality_hold_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\": 3719.324171623398, \"DC2\": 3451.9614334146313, \"DC3\": 2872.8961546203122, \"DC4\": 3001.786707072527, \"DC5\": 2810.787383672959}, \"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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \"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\": [336, 321, 368, 348, 486, 615, 673, 849, 1023, 1375, 1266, 1161, 1014, 881, 775, 596, 415, 394, 350, 275], \"SKU_Premium\": [150, 133, 146, 172, 229, 302, 318, 503, 539, 622, 561, 591, 519, 463, 303, 276, 248, 200, 184, 171], \"SKU_ShortLife\": [129, 128, 132, 154, 170, 244, 247, 308, 398, 467, 447, 449, 395, 343, 321, 192, 188, 144, 116, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 556194.0} {"scenario_id": "retail_f4_quality_hold_v3", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_quality_hold_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4348.14731886087,\n \"DC2\": 3443.0263900360433,\n \"DC3\": 2786.2660090945456,\n \"DC4\": 3209.6500684028438,\n \"DC5\": 2800.508015690938\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 313,\n 270,\n 291,\n 350,\n 459,\n 500,\n 811,\n 963,\n 1254,\n 1251,\n 1210,\n 1388,\n 1148,\n 946,\n 684,\n 545,\n 408,\n 392,\n 371,\n 288\n ],\n \"SKU_Premium\": [\n 157,\n 167,\n 153,\n 173,\n 244,\n 252,\n 396,\n 388,\n 471,\n 531,\n 649,\n 621,\n 573,\n 416,\n 353,\n 243,\n 192,\n 195,\n 144,\n 133\n ],\n \"SKU_ShortLife\": [\n 110,\n 112,\n 112,\n 139,\n 158,\n 192,\n 306,\n 321,\n 428,\n 492,\n 579,\n 468,\n 378,\n 383,\n 265,\n 209,\n 168,\n 130,\n 117,\n 125\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_quality_hold_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\": 4348.14731886087, \"DC2\": 3443.0263900360433, \"DC3\": 2786.2660090945456, \"DC4\": 3209.6500684028438, \"DC5\": 2800.508015690938}, \"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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \"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\": [313, 270, 291, 350, 459, 500, 811, 963, 1254, 1251, 1210, 1388, 1148, 946, 684, 545, 408, 392, 371, 288], \"SKU_Premium\": [157, 167, 153, 173, 244, 252, 396, 388, 471, 531, 649, 621, 573, 416, 353, 243, 192, 195, 144, 133], \"SKU_ShortLife\": [110, 112, 112, 139, 158, 192, 306, 321, 428, 492, 579, 468, 378, 383, 265, 209, 168, 130, 117, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 565214.0} {"scenario_id": "retail_f4_quality_hold_v4", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_quality_hold\nScenario ID: retail_f4_quality_hold_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA quality issue forces the retailer to halt production of the basic product after a certain time. Existing units of that product can still be sold until they are exhausted or expire, but no new units can be produced during the hold window. Demand for other products is unaffected. Unserved demand for the basic product is lost and penalized, even if substitutes exist.\n\nStructure cues:\n- The inventory and production logic is the same as in the base scenario: single-echelon, local demand, local production, and no transshipment.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, the production capacity for the basic product is set to zero after a specified time index, while other products retain their production capacities.\n- Inventory for each product and location evolves from period to period based on previous stock, production (which is zero for the basic product during the hold), sales, and waste, and must remain non-negative.\n- Any unmet demand for the basic product after considering allowed substitution becomes lost sales.\n- Substitution behavior, zero lead times, and generous labor capacity remain as usual.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while capturing the effect of the asymmetric quality hold on the basic product.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_quality_hold_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4556.4980603070635,\n \"DC2\": 3190.1866711249513,\n \"DC3\": 3205.4948829719656,\n \"DC4\": 3387.4257588259015,\n \"DC5\": 2370.365958570004\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 339,\n 287,\n 349,\n 321,\n 423,\n 539,\n 750,\n 797,\n 1048,\n 1154,\n 1222,\n 1175,\n 1193,\n 916,\n 648,\n 601,\n 484,\n 401,\n 337,\n 346\n ],\n \"SKU_Premium\": [\n 133,\n 161,\n 171,\n 208,\n 217,\n 308,\n 308,\n 405,\n 485,\n 684,\n 610,\n 580,\n 543,\n 436,\n 372,\n 264,\n 227,\n 203,\n 142,\n 176\n ],\n \"SKU_ShortLife\": [\n 104,\n 124,\n 134,\n 163,\n 171,\n 216,\n 301,\n 368,\n 399,\n 473,\n 539,\n 424,\n 378,\n 387,\n 259,\n 233,\n 159,\n 160,\n 114,\n 117\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_quality_hold_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\": 4556.4980603070635, \"DC2\": 3190.1866711249513, \"DC3\": 3205.4948829719656, \"DC4\": 3387.4257588259015, \"DC5\": 2370.365958570004}, \"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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \"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\": [339, 287, 349, 321, 423, 539, 750, 797, 1048, 1154, 1222, 1175, 1193, 916, 648, 601, 484, 401, 337, 346], \"SKU_Premium\": [133, 161, 171, 208, 217, 308, 308, 405, 485, 684, 610, 580, 543, 436, 372, 264, 227, 203, 142, 176], \"SKU_ShortLife\": [104, 124, 134, 163, 171, 216, 301, 368, 399, 473, 539, 424, 378, 387, 259, 233, 159, 160, 114, 117]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 550111.0} {"scenario_id": "retail_f4_robust_variance_v0", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_robust_variance_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 454,\n 217,\n 492,\n 255,\n 652,\n 384,\n 1066,\n 634,\n 1650,\n 871,\n 1950,\n 871,\n 1650,\n 634,\n 1066,\n 384,\n 652,\n 255,\n 492,\n 217\n ],\n \"SKU_Premium\": [\n 226,\n 108,\n 246,\n 127,\n 325,\n 191,\n 532,\n 317,\n 825,\n 435,\n 975,\n 435,\n 825,\n 317,\n 532,\n 191,\n 325,\n 127,\n 246,\n 108\n ],\n \"SKU_ShortLife\": [\n 181,\n 86,\n 196,\n 102,\n 261,\n 153,\n 426,\n 253,\n 660,\n 348,\n 780,\n 348,\n 660,\n 253,\n 426,\n 153,\n 261,\n 102,\n 196,\n 86\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 125.0,\n \"SKU_Premium\": 200.0,\n \"SKU_ShortLife\": 100.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_robust_variance_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\": [454, 217, 492, 255, 652, 384, 1066, 634, 1650, 871, 1950, 871, 1650, 634, 1066, 384, 652, 255, 492, 217], \"SKU_Premium\": [226, 108, 246, 127, 325, 191, 532, 317, 825, 435, 975, 435, 825, 317, 532, 191, 325, 127, 246, 108], \"SKU_ShortLife\": [181, 86, 196, 102, 261, 153, 426, 253, 660, 348, 780, 348, 660, 253, 426, 153, 261, 102, 196, 86]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 125.0, \"SKU_Premium\": 200.0, \"SKU_ShortLife\": 100.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 586968.0} {"scenario_id": "retail_f4_robust_variance_v1", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_robust_variance_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3690.5781657398916,\n \"DC2\": 3129.7560314876814,\n \"DC3\": 3025.632985653835,\n \"DC4\": 3340.4210014631576,\n \"DC5\": 2464.947660701796\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 476,\n 192,\n 445,\n 217,\n 635,\n 341,\n 1009,\n 696,\n 1880,\n 849,\n 1841,\n 1000,\n 1658,\n 618,\n 1197,\n 410,\n 584,\n 237,\n 475,\n 198\n ],\n \"SKU_Premium\": [\n 209,\n 120,\n 255,\n 118,\n 344,\n 169,\n 496,\n 334,\n 791,\n 410,\n 948,\n 448,\n 825,\n 323,\n 478,\n 196,\n 306,\n 128,\n 243,\n 121\n ],\n \"SKU_ShortLife\": [\n 155,\n 88,\n 224,\n 104,\n 239,\n 130,\n 368,\n 239,\n 659,\n 359,\n 665,\n 399,\n 740,\n 244,\n 384,\n 161,\n 237,\n 92,\n 219,\n 96\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 125.0,\n \"SKU_Premium\": 200.0,\n \"SKU_ShortLife\": 100.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_robust_variance_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\": 3690.5781657398916, \"DC2\": 3129.7560314876814, \"DC3\": 3025.632985653835, \"DC4\": 3340.4210014631576, \"DC5\": 2464.947660701796}, \"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\": [476, 192, 445, 217, 635, 341, 1009, 696, 1880, 849, 1841, 1000, 1658, 618, 1197, 410, 584, 237, 475, 198], \"SKU_Premium\": [209, 120, 255, 118, 344, 169, 496, 334, 791, 410, 948, 448, 825, 323, 478, 196, 306, 128, 243, 121], \"SKU_ShortLife\": [155, 88, 224, 104, 239, 130, 368, 239, 659, 359, 665, 399, 740, 244, 384, 161, 237, 92, 219, 96]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 125.0, \"SKU_Premium\": 200.0, \"SKU_ShortLife\": 100.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 581911.0} {"scenario_id": "retail_f4_robust_variance_v2", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_robust_variance_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3458.60192317133,\n \"DC2\": 3324.742954915987,\n \"DC3\": 2621.698502751688,\n \"DC4\": 2636.1542097279935,\n \"DC5\": 2835.361795125418\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 393,\n 238,\n 530,\n 264,\n 748,\n 328,\n 1002,\n 657,\n 1674,\n 971,\n 2198,\n 990,\n 1704,\n 592,\n 1128,\n 368,\n 682,\n 221,\n 506,\n 214\n ],\n \"SKU_Premium\": [\n 238,\n 105,\n 233,\n 111,\n 367,\n 193,\n 513,\n 296,\n 899,\n 445,\n 885,\n 424,\n 779,\n 324,\n 598,\n 211,\n 300,\n 109,\n 263,\n 107\n ],\n \"SKU_ShortLife\": [\n 161,\n 89,\n 211,\n 88,\n 231,\n 156,\n 457,\n 266,\n 639,\n 360,\n 739,\n 317,\n 635,\n 275,\n 389,\n 168,\n 240,\n 89,\n 181,\n 83\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 125.0,\n \"SKU_Premium\": 200.0,\n \"SKU_ShortLife\": 100.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_robust_variance_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\": 3458.60192317133, \"DC2\": 3324.742954915987, \"DC3\": 2621.698502751688, \"DC4\": 2636.1542097279935, \"DC5\": 2835.361795125418}, \"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\": [393, 238, 530, 264, 748, 328, 1002, 657, 1674, 971, 2198, 990, 1704, 592, 1128, 368, 682, 221, 506, 214], \"SKU_Premium\": [238, 105, 233, 111, 367, 193, 513, 296, 899, 445, 885, 424, 779, 324, 598, 211, 300, 109, 263, 107], \"SKU_ShortLife\": [161, 89, 211, 88, 231, 156, 457, 266, 639, 360, 739, 317, 635, 275, 389, 168, 240, 89, 181, 83]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 125.0, \"SKU_Premium\": 200.0, \"SKU_ShortLife\": 100.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 653731.0} {"scenario_id": "retail_f4_robust_variance_v3", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_robust_variance_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3807.342214076429,\n \"DC2\": 3919.53090027197,\n \"DC3\": 3397.127516750158,\n \"DC4\": 3050.5506360588874,\n \"DC5\": 2418.224884989464\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 388,\n 235,\n 482,\n 260,\n 690,\n 352,\n 1149,\n 726,\n 1588,\n 943,\n 2110,\n 804,\n 1789,\n 648,\n 1058,\n 330,\n 563,\n 286,\n 445,\n 217\n ],\n \"SKU_Premium\": [\n 218,\n 113,\n 254,\n 136,\n 304,\n 215,\n 454,\n 291,\n 758,\n 387,\n 968,\n 467,\n 833,\n 294,\n 572,\n 197,\n 333,\n 145,\n 247,\n 93\n ],\n \"SKU_ShortLife\": [\n 194,\n 88,\n 223,\n 112,\n 246,\n 159,\n 383,\n 244,\n 678,\n 301,\n 816,\n 395,\n 642,\n 268,\n 416,\n 162,\n 231,\n 107,\n 188,\n 92\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 125.0,\n \"SKU_Premium\": 200.0,\n \"SKU_ShortLife\": 100.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_robust_variance_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\": 3807.342214076429, \"DC2\": 3919.53090027197, \"DC3\": 3397.127516750158, \"DC4\": 3050.5506360588874, \"DC5\": 2418.224884989464}, \"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\": [388, 235, 482, 260, 690, 352, 1149, 726, 1588, 943, 2110, 804, 1789, 648, 1058, 330, 563, 286, 445, 217], \"SKU_Premium\": [218, 113, 254, 136, 304, 215, 454, 291, 758, 387, 968, 467, 833, 294, 572, 197, 333, 145, 247, 93], \"SKU_ShortLife\": [194, 88, 223, 112, 246, 159, 383, 244, 678, 301, 816, 395, 642, 268, 416, 162, 231, 107, 188, 92]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 125.0, \"SKU_Premium\": 200.0, \"SKU_ShortLife\": 100.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 603673.5} {"scenario_id": "retail_f4_robust_variance_v4", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_robust_variance\nScenario ID: retail_f4_robust_variance_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand alternates between high and low phases over the planning horizon, and lost sales are made very expensive. This mimics a robust-planning environment where the retailer must guard against demand variance rather than a single deterministic forecast. Demand is still exogenous and local at each location, with no backorders and no transshipment.\n\nStructure cues:\n- The inventory, storage, and production structure is the same single-echelon system as in the base scenario, with per-product production capacities and local inventories at each location.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, demand curves oscillate across periods, creating repeated high-demand and low-demand phases; lost sales penalties are increased for all products so that stockouts are very costly.\n- Inventory at each product, location, and period remains non-negative and evolves from previous stock and current production, minus sales and waste.\n- Substitution behavior, zero lead times, and generous labor capacity remain in effect as in other Family 4 archetypes.\n- The objective is to minimize total cost including purchasing, holding, waste, and lost sales penalties, encouraging robust safety-stock style planning against the demand variance.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_robust_variance_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4515.340161047244,\n \"DC2\": 3824.6710029835804,\n \"DC3\": 3360.1445864457164,\n \"DC4\": 3362.680926789409,\n \"DC5\": 2537.475499031382\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 396,\n 216,\n 559,\n 223,\n 689,\n 432,\n 984,\n 701,\n 1467,\n 958,\n 2047,\n 791,\n 1766,\n 609,\n 1174,\n 410,\n 627,\n 282,\n 526,\n 245\n ],\n \"SKU_Premium\": [\n 249,\n 109,\n 227,\n 120,\n 306,\n 180,\n 567,\n 323,\n 736,\n 497,\n 860,\n 432,\n 926,\n 319,\n 560,\n 183,\n 338,\n 115,\n 261,\n 101\n ],\n \"SKU_ShortLife\": [\n 157,\n 83,\n 181,\n 108,\n 267,\n 158,\n 409,\n 249,\n 712,\n 399,\n 867,\n 373,\n 726,\n 283,\n 454,\n 144,\n 256,\n 111,\n 189,\n 75\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 125.0,\n \"SKU_Premium\": 200.0,\n \"SKU_ShortLife\": 100.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_robust_variance_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\": 4515.340161047244, \"DC2\": 3824.6710029835804, \"DC3\": 3360.1445864457164, \"DC4\": 3362.680926789409, \"DC5\": 2537.475499031382}, \"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\": [396, 216, 559, 223, 689, 432, 984, 701, 1467, 958, 2047, 791, 1766, 609, 1174, 410, 627, 282, 526, 245], \"SKU_Premium\": [249, 109, 227, 120, 306, 180, 567, 323, 736, 497, 860, 432, 926, 319, 560, 183, 338, 115, 261, 101], \"SKU_ShortLife\": [157, 83, 181, 108, 267, 158, 409, 249, 712, 399, 867, 373, 726, 283, 454, 144, 256, 111, 189, 75]}, \"demand_share\": {\"DC1\": 0.25, \"DC2\": 0.2, \"DC3\": 0.2, \"DC4\": 0.2, \"DC5\": 0.15}, \"costs\": {\"lost_sales\": {\"SKU_Basic\": 125.0, \"SKU_Premium\": 200.0, \"SKU_ShortLife\": 100.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 613811.0} {"scenario_id": "retail_f4_supply_risk_v0", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_supply_risk_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 320,\n 320,\n 320,\n 320,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 160,\n 160,\n 160,\n 160,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 200,\n 200,\n 200,\n 200,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 6.0,\n \"SKU_Premium\": 9.0,\n \"SKU_ShortLife\": 6.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_supply_risk_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, 320, 320, 320, 320, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 160, 160, 160, 160, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 200, 200, 200, 200, 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\": 6.0, \"SKU_Premium\": 9.0, \"SKU_ShortLife\": 6.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 484996.5} {"scenario_id": "retail_f4_supply_risk_v1", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_supply_risk_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3615.226515295144,\n \"DC2\": 3960.4177892282714,\n \"DC3\": 2905.4633856970304,\n \"DC4\": 2644.980081532301,\n \"DC5\": 2228.6235235015124\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 320,\n 320,\n 320,\n 320,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 160,\n 160,\n 160,\n 160,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 200,\n 200,\n 200,\n 200,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 277,\n 264,\n 371,\n 350,\n 399,\n 599,\n 767,\n 1010,\n 1207,\n 1067,\n 1449,\n 1297,\n 1227,\n 911,\n 746,\n 510,\n 481,\n 347,\n 340,\n 327\n ],\n \"SKU_Premium\": [\n 165,\n 173,\n 185,\n 168,\n 205,\n 309,\n 379,\n 426,\n 482,\n 619,\n 573,\n 669,\n 577,\n 398,\n 304,\n 247,\n 224,\n 165,\n 172,\n 148\n ],\n \"SKU_ShortLife\": [\n 104,\n 118,\n 128,\n 138,\n 152,\n 232,\n 287,\n 373,\n 416,\n 475,\n 589,\n 463,\n 409,\n 373,\n 267,\n 222,\n 169,\n 133,\n 129,\n 131\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 6.0,\n \"SKU_Premium\": 9.0,\n \"SKU_ShortLife\": 6.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_supply_risk_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\": 3615.226515295144, \"DC2\": 3960.4177892282714, \"DC3\": 2905.4633856970304, \"DC4\": 2644.980081532301, \"DC5\": 2228.6235235015124}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [800, 800, 800, 800, 800, 800, 320, 320, 320, 320, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 160, 160, 160, 160, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 200, 200, 200, 200, 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\": [277, 264, 371, 350, 399, 599, 767, 1010, 1207, 1067, 1449, 1297, 1227, 911, 746, 510, 481, 347, 340, 327], \"SKU_Premium\": [165, 173, 185, 168, 205, 309, 379, 426, 482, 619, 573, 669, 577, 398, 304, 247, 224, 165, 172, 148], \"SKU_ShortLife\": [104, 118, 128, 138, 152, 232, 287, 373, 416, 475, 589, 463, 409, 373, 267, 222, 169, 133, 129, 131]}, \"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\": 6.0, \"SKU_Premium\": 9.0, \"SKU_ShortLife\": 6.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 496085.0} {"scenario_id": "retail_f4_supply_risk_v2", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_supply_risk_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4483.315560571136,\n \"DC2\": 3606.5407916807635,\n \"DC3\": 2819.5786301383314,\n \"DC4\": 2948.8982552513794,\n \"DC5\": 2789.1397056477617\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 320,\n 320,\n 320,\n 320,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 160,\n 160,\n 160,\n 160,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 200,\n 200,\n 200,\n 200,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 335,\n 281,\n 360,\n 397,\n 464,\n 605,\n 693,\n 866,\n 1212,\n 1334,\n 1258,\n 1258,\n 1160,\n 806,\n 634,\n 492,\n 403,\n 397,\n 334,\n 335\n ],\n \"SKU_Premium\": [\n 156,\n 143,\n 153,\n 194,\n 248,\n 263,\n 403,\n 410,\n 553,\n 678,\n 679,\n 678,\n 573,\n 507,\n 334,\n 297,\n 229,\n 192,\n 157,\n 167\n ],\n \"SKU_ShortLife\": [\n 136,\n 119,\n 128,\n 159,\n 164,\n 232,\n 248,\n 416,\n 494,\n 519,\n 543,\n 541,\n 424,\n 319,\n 301,\n 219,\n 156,\n 140,\n 146,\n 105\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 6.0,\n \"SKU_Premium\": 9.0,\n \"SKU_ShortLife\": 6.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_supply_risk_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\": 4483.315560571136, \"DC2\": 3606.5407916807635, \"DC3\": 2819.5786301383314, \"DC4\": 2948.8982552513794, \"DC5\": 2789.1397056477617}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [800, 800, 800, 800, 800, 800, 320, 320, 320, 320, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 160, 160, 160, 160, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 200, 200, 200, 200, 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\": [335, 281, 360, 397, 464, 605, 693, 866, 1212, 1334, 1258, 1258, 1160, 806, 634, 492, 403, 397, 334, 335], \"SKU_Premium\": [156, 143, 153, 194, 248, 263, 403, 410, 553, 678, 679, 678, 573, 507, 334, 297, 229, 192, 157, 167], \"SKU_ShortLife\": [136, 119, 128, 159, 164, 232, 248, 416, 494, 519, 543, 541, 424, 319, 301, 219, 156, 140, 146, 105]}, \"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\": 6.0, \"SKU_Premium\": 9.0, \"SKU_ShortLife\": 6.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 516706.5} {"scenario_id": "retail_f4_supply_risk_v3", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_supply_risk_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4099.018005363058,\n \"DC2\": 3737.8155386295125,\n \"DC3\": 3409.095382187711,\n \"DC4\": 3094.190919701873,\n \"DC5\": 2361.6437650828752\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 320,\n 320,\n 320,\n 320,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 160,\n 160,\n 160,\n 160,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 200,\n 200,\n 200,\n 200,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 280,\n 305,\n 329,\n 344,\n 416,\n 493,\n 769,\n 828,\n 998,\n 1337,\n 1422,\n 1316,\n 1144,\n 886,\n 802,\n 536,\n 424,\n 412,\n 371,\n 311\n ],\n \"SKU_Premium\": [\n 165,\n 177,\n 168,\n 200,\n 216,\n 240,\n 318,\n 452,\n 536,\n 542,\n 612,\n 544,\n 522,\n 475,\n 330,\n 312,\n 230,\n 197,\n 185,\n 154\n ],\n \"SKU_ShortLife\": [\n 112,\n 111,\n 137,\n 135,\n 188,\n 243,\n 241,\n 396,\n 437,\n 570,\n 566,\n 500,\n 435,\n 397,\n 266,\n 212,\n 188,\n 160,\n 133,\n 142\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 6.0,\n \"SKU_Premium\": 9.0,\n \"SKU_ShortLife\": 6.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_supply_risk_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\": 4099.018005363058, \"DC2\": 3737.8155386295125, \"DC3\": 3409.095382187711, \"DC4\": 3094.190919701873, \"DC5\": 2361.6437650828752}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [800, 800, 800, 800, 800, 800, 320, 320, 320, 320, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 160, 160, 160, 160, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 200, 200, 200, 200, 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\": [280, 305, 329, 344, 416, 493, 769, 828, 998, 1337, 1422, 1316, 1144, 886, 802, 536, 424, 412, 371, 311], \"SKU_Premium\": [165, 177, 168, 200, 216, 240, 318, 452, 536, 542, 612, 544, 522, 475, 330, 312, 230, 197, 185, 154], \"SKU_ShortLife\": [112, 111, 137, 135, 188, 243, 241, 396, 437, 570, 566, 500, 435, 397, 266, 212, 188, 160, 133, 142]}, \"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\": 6.0, \"SKU_Premium\": 9.0, \"SKU_ShortLife\": 6.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 476425.5} {"scenario_id": "retail_f4_supply_risk_v4", "prompt_schema": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F4 (Dynamics and Disruptions)\nArchetype: retail_f4_supply_risk\nScenario ID: retail_f4_supply_risk_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces persistent but moderate supply risk in the middle of the season. Production capacity is reduced over a mid-horizon band of periods, and waste becomes more expensive. Demand remains exogenous and local, with no backorders and no transshipment. The retailer must decide how much to build inventory before the risk window, balancing the danger of stockouts against the risk of obsolescence and waste.\n\nStructure cues:\n- The inventory, storage, and lost sales framework is the same single-echelon structure as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, per-product production capacities are reduced over a specified mid-horizon band of periods, but not set to zero. Outside this band, capacities are higher and should be used to build inventory when beneficial.\n- Waste cost parameters are increased for all products so that discarding inventory is more expensive, making overbuilding before the risk window more costly.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, allowed production, sales, and waste.\n- Substitution behavior, zero lead times, and generous labor capacity are unchanged from the baseline.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while trading off early inventory builds against the increased waste cost and mid-season supply risk.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f4_supply_risk_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4537.275036754515,\n \"DC2\": 3044.4506354810037,\n \"DC3\": 3163.599696417805,\n \"DC4\": 2913.458675798127,\n \"DC5\": 2149.257743710531\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 320,\n 320,\n 320,\n 320,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 160,\n 160,\n 160,\n 160,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 200,\n 200,\n 200,\n 200,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 319,\n 299,\n 342,\n 413,\n 497,\n 500,\n 719,\n 966,\n 991,\n 1166,\n 1493,\n 1303,\n 1188,\n 1005,\n 674,\n 525,\n 433,\n 416,\n 312,\n 268\n ],\n \"SKU_Premium\": [\n 170,\n 138,\n 170,\n 185,\n 199,\n 273,\n 350,\n 453,\n 531,\n 653,\n 671,\n 560,\n 531,\n 514,\n 305,\n 233,\n 185,\n 174,\n 174,\n 156\n ],\n \"SKU_ShortLife\": [\n 120,\n 130,\n 118,\n 128,\n 181,\n 201,\n 304,\n 310,\n 459,\n 431,\n 464,\n 556,\n 422,\n 343,\n 320,\n 220,\n 160,\n 126,\n 144,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 6.0,\n \"SKU_Premium\": 9.0,\n \"SKU_ShortLife\": 6.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f4_supply_risk_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\": 4537.275036754515, \"DC2\": 3044.4506354810037, \"DC3\": 3163.599696417805, \"DC4\": 2913.458675798127, \"DC5\": 2149.257743710531}, \"cold_usage\": {\"SKU_Basic\": 1.0, \"SKU_Premium\": 3.0, \"SKU_ShortLife\": 1.2}, \"production_cap\": {\"SKU_Basic\": [800, 800, 800, 800, 800, 800, 320, 320, 320, 320, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 160, 160, 160, 160, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 200, 200, 200, 200, 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, 299, 342, 413, 497, 500, 719, 966, 991, 1166, 1493, 1303, 1188, 1005, 674, 525, 433, 416, 312, 268], \"SKU_Premium\": [170, 138, 170, 185, 199, 273, 350, 453, 531, 653, 671, 560, 531, 514, 305, 233, 185, 174, 174, 156], \"SKU_ShortLife\": [120, 130, 118, 128, 181, 201, 304, 310, 459, 431, 464, 556, 422, 343, 320, 220, 160, 126, 144, 130]}, \"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\": 6.0, \"SKU_Premium\": 9.0, \"SKU_ShortLife\": 6.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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 498825.0} {"scenario_id": "retail_f5_impossible_demand_v0", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_impossible_demand_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 1515,\n 1555,\n 1640,\n 1825,\n 2175,\n 2745,\n 3555,\n 4530,\n 5500,\n 6225,\n 6500,\n 6225,\n 5500,\n 4530,\n 3555,\n 2745,\n 2175,\n 1825,\n 1640,\n 1555\n ],\n \"SKU_Premium\": [\n 755,\n 775,\n 820,\n 910,\n 1085,\n 1370,\n 1775,\n 2265,\n 2750,\n 3110,\n 3250,\n 3110,\n 2750,\n 2265,\n 1775,\n 1370,\n 1085,\n 910,\n 820,\n 775\n ],\n \"SKU_ShortLife\": [\n 605,\n 620,\n 655,\n 730,\n 870,\n 1095,\n 1420,\n 1810,\n 2200,\n 2490,\n 2600,\n 2490,\n 2200,\n 1810,\n 1420,\n 1095,\n 870,\n 730,\n 655,\n 620\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_impossible_demand_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\": [1515, 1555, 1640, 1825, 2175, 2745, 3555, 4530, 5500, 6225, 6500, 6225, 5500, 4530, 3555, 2745, 2175, 1825, 1640, 1555], \"SKU_Premium\": [755, 775, 820, 910, 1085, 1370, 1775, 2265, 2750, 3110, 3250, 3110, 2750, 2265, 1775, 1370, 1085, 910, 820, 775], \"SKU_ShortLife\": [605, 620, 655, 730, 870, 1095, 1420, 1810, 2200, 2490, 2600, 2490, 2200, 1810, 1420, 1095, 870, 730, 655, 620]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 5783150.0} {"scenario_id": "retail_f5_impossible_demand_v1", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_impossible_demand_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3455.946042328614,\n \"DC2\": 3411.6905421659267,\n \"DC3\": 2938.7657892624347,\n \"DC4\": 2591.031347635626,\n \"DC5\": 2836.4739469844926\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 1294,\n 1369,\n 1565,\n 1729,\n 2431,\n 2756,\n 3498,\n 4534,\n 5201,\n 6842,\n 7260,\n 5625,\n 5343,\n 3968,\n 3413,\n 2645,\n 2446,\n 1631,\n 1829,\n 1640\n ],\n \"SKU_Premium\": [\n 661,\n 706,\n 732,\n 959,\n 975,\n 1506,\n 1664,\n 1973,\n 2540,\n 3207,\n 3638,\n 2944,\n 2846,\n 1928,\n 1579,\n 1445,\n 1059,\n 1006,\n 850,\n 854\n ],\n \"SKU_ShortLife\": [\n 524,\n 639,\n 677,\n 837,\n 823,\n 1098,\n 1615,\n 1844,\n 1887,\n 2630,\n 2585,\n 2408,\n 2232,\n 2059,\n 1478,\n 1029,\n 758,\n 762,\n 619,\n 707\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_impossible_demand_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\": 3455.946042328614, \"DC2\": 3411.6905421659267, \"DC3\": 2938.7657892624347, \"DC4\": 2591.031347635626, \"DC5\": 2836.4739469844926}, \"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\": [1294, 1369, 1565, 1729, 2431, 2756, 3498, 4534, 5201, 6842, 7260, 5625, 5343, 3968, 3413, 2645, 2446, 1631, 1829, 1640], \"SKU_Premium\": [661, 706, 732, 959, 975, 1506, 1664, 1973, 2540, 3207, 3638, 2944, 2846, 1928, 1579, 1445, 1059, 1006, 850, 854], \"SKU_ShortLife\": [524, 639, 677, 837, 823, 1098, 1615, 1844, 1887, 2630, 2585, 2408, 2232, 2059, 1478, 1029, 758, 762, 619, 707]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 5715150.0} {"scenario_id": "retail_f5_impossible_demand_v2", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_impossible_demand_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4067.569365569927,\n \"DC2\": 3623.3772551419306,\n \"DC3\": 2801.945630602482,\n \"DC4\": 2609.475399344963,\n \"DC5\": 2322.0037150444923\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 1499,\n 1535,\n 1458,\n 1573,\n 2144,\n 2525,\n 3442,\n 4214,\n 5104,\n 7034,\n 7405,\n 7103,\n 5563,\n 4698,\n 3814,\n 2352,\n 2040,\n 2063,\n 1600,\n 1473\n ],\n \"SKU_Premium\": [\n 806,\n 800,\n 828,\n 815,\n 1114,\n 1493,\n 1553,\n 2126,\n 2686,\n 2822,\n 3486,\n 2922,\n 3045,\n 2309,\n 1817,\n 1513,\n 931,\n 1012,\n 715,\n 711\n ],\n \"SKU_ShortLife\": [\n 515,\n 612,\n 676,\n 750,\n 998,\n 1221,\n 1472,\n 1654,\n 2464,\n 2274,\n 2414,\n 2711,\n 1934,\n 1697,\n 1317,\n 958,\n 972,\n 719,\n 557,\n 549\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_impossible_demand_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\": 4067.569365569927, \"DC2\": 3623.3772551419306, \"DC3\": 2801.945630602482, \"DC4\": 2609.475399344963, \"DC5\": 2322.0037150444923}, \"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\": [1499, 1535, 1458, 1573, 2144, 2525, 3442, 4214, 5104, 7034, 7405, 7103, 5563, 4698, 3814, 2352, 2040, 2063, 1600, 1473], \"SKU_Premium\": [806, 800, 828, 815, 1114, 1493, 1553, 2126, 2686, 2822, 3486, 2922, 3045, 2309, 1817, 1513, 931, 1012, 715, 711], \"SKU_ShortLife\": [515, 612, 676, 750, 998, 1221, 1472, 1654, 2464, 2274, 2414, 2711, 1934, 1697, 1317, 958, 972, 719, 557, 549]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 5800830.0} {"scenario_id": "retail_f5_impossible_demand_v3", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_impossible_demand_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4030.4315080093147,\n \"DC2\": 3754.6806863069964,\n \"DC3\": 3048.7512491469884,\n \"DC4\": 3291.0240262346656,\n \"DC5\": 2196.8963622117362\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 1514,\n 1534,\n 1505,\n 1590,\n 2109,\n 3113,\n 3643,\n 4459,\n 4759,\n 6018,\n 6489,\n 6781,\n 5356,\n 4183,\n 3436,\n 2370,\n 2236,\n 2012,\n 1660,\n 1691\n ],\n \"SKU_Premium\": [\n 759,\n 737,\n 877,\n 899,\n 1106,\n 1393,\n 2015,\n 2289,\n 2875,\n 3148,\n 3165,\n 2707,\n 3063,\n 2352,\n 1595,\n 1316,\n 1206,\n 838,\n 934,\n 868\n ],\n \"SKU_ShortLife\": [\n 522,\n 561,\n 616,\n 705,\n 838,\n 1050,\n 1330,\n 1556,\n 2470,\n 2650,\n 2973,\n 2704,\n 1948,\n 1602,\n 1351,\n 1080,\n 828,\n 710,\n 695,\n 699\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_impossible_demand_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\": 4030.4315080093147, \"DC2\": 3754.6806863069964, \"DC3\": 3048.7512491469884, \"DC4\": 3291.0240262346656, \"DC5\": 2196.8963622117362}, \"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\": [1514, 1534, 1505, 1590, 2109, 3113, 3643, 4459, 4759, 6018, 6489, 6781, 5356, 4183, 3436, 2370, 2236, 2012, 1660, 1691], \"SKU_Premium\": [759, 737, 877, 899, 1106, 1393, 2015, 2289, 2875, 3148, 3165, 2707, 3063, 2352, 1595, 1316, 1206, 838, 934, 868], \"SKU_ShortLife\": [522, 561, 616, 705, 838, 1050, 1330, 1556, 2470, 2650, 2973, 2704, 1948, 1602, 1351, 1080, 828, 710, 695, 699]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 5759780.0} {"scenario_id": "retail_f5_impossible_demand_v4", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_impossible_demand\nScenario ID: retail_f5_impossible_demand_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nDemand is scaled so high that it is physically impossible to satisfy all of it given the production and storage capacities. Even with perfect planning, some demand must be sacrificed. This scenario is designed to test whether the model correctly accepts that full service is impossible and uses lost sales to remain feasible instead of implicitly assuming 100% service.\n\nStructure cues:\n- The inventory, production, storage, and lost sales framework is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- In the JSON, all demand curves are multiplied by 5x so that total demand over the horizon far exceeds what can be produced or stored. The model should not attempt to enforce full demand satisfaction; lost sales must be used where necessary.\n- Inventory at each location and period is kept non-negative and reflects previous stock, local production, sales, and waste.\n- Production capacity constraints must be applied as given.\n- There is no transshipment, lead times are zero, and substitution behavior follows the substitution graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), effectively performing a form of model repair by accepting partial service.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_impossible_demand_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3992.538720739766,\n \"DC2\": 3774.318985202688,\n \"DC3\": 3035.9933380966336,\n \"DC4\": 2620.828139803654,\n \"DC5\": 2232.0057603151076\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 1662,\n 1713,\n 1560,\n 1992,\n 2169,\n 2595,\n 3766,\n 4749,\n 5852,\n 5550,\n 6503,\n 6670,\n 5155,\n 3895,\n 3709,\n 2479,\n 2289,\n 2029,\n 1701,\n 1418\n ],\n \"SKU_Premium\": [\n 689,\n 828,\n 712,\n 990,\n 939,\n 1353,\n 1901,\n 2510,\n 2664,\n 3494,\n 3202,\n 2721,\n 2846,\n 1998,\n 1584,\n 1288,\n 941,\n 804,\n 844,\n 865\n ],\n \"SKU_ShortLife\": [\n 551,\n 654,\n 736,\n 664,\n 880,\n 1246,\n 1365,\n 1835,\n 2087,\n 2450,\n 2464,\n 2137,\n 2021,\n 1923,\n 1304,\n 1235,\n 926,\n 836,\n 651,\n 658\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_impossible_demand_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\": 3992.538720739766, \"DC2\": 3774.318985202688, \"DC3\": 3035.9933380966336, \"DC4\": 2620.828139803654, \"DC5\": 2232.0057603151076}, \"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\": [1662, 1713, 1560, 1992, 2169, 2595, 3766, 4749, 5852, 5550, 6503, 6670, 5155, 3895, 3709, 2479, 2289, 2029, 1701, 1418], \"SKU_Premium\": [689, 828, 712, 990, 939, 1353, 1901, 2510, 2664, 3494, 3202, 2721, 2846, 1998, 1584, 1288, 941, 804, 844, 865], \"SKU_ShortLife\": [551, 654, 736, 664, 880, 1246, 1365, 1835, 2087, 2450, 2464, 2137, 2021, 1923, 1304, 1235, 926, 836, 651, 658]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 5721560.0} {"scenario_id": "retail_f5_storage_overflow_v0", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_storage_overflow_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 0.5,\n \"DC2\": 0.5,\n \"DC3\": 0.5,\n \"DC4\": 0.5,\n \"DC5\": 0.5\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_storage_overflow_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\": 0.5, \"DC2\": 0.5, \"DC3\": 0.5, \"DC4\": 0.5, \"DC5\": 0.5}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1428630.0} {"scenario_id": "retail_f5_storage_overflow_v1", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_storage_overflow_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 0.456340963535972,\n \"DC2\": 0.4563086816469306,\n \"DC3\": 0.4258276302523486,\n \"DC4\": 0.4304943572797052,\n \"DC5\": 0.4392638103302234\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 265,\n 291,\n 300,\n 391,\n 470,\n 532,\n 684,\n 835,\n 986,\n 1254,\n 1425,\n 1169,\n 1061,\n 886,\n 705,\n 546,\n 445,\n 321,\n 296,\n 348\n ],\n \"SKU_Premium\": [\n 153,\n 170,\n 169,\n 207,\n 244,\n 275,\n 402,\n 402,\n 607,\n 698,\n 602,\n 626,\n 468,\n 514,\n 336,\n 284,\n 231,\n 183,\n 188,\n 150\n ],\n \"SKU_ShortLife\": [\n 107,\n 134,\n 139,\n 159,\n 160,\n 242,\n 271,\n 403,\n 406,\n 525,\n 555,\n 473,\n 439,\n 344,\n 305,\n 226,\n 167,\n 149,\n 120,\n 129\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_storage_overflow_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\": 0.456340963535972, \"DC2\": 0.4563086816469306, \"DC3\": 0.4258276302523486, \"DC4\": 0.4304943572797052, \"DC5\": 0.4392638103302234}, \"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\": [265, 291, 300, 391, 470, 532, 684, 835, 986, 1254, 1425, 1169, 1061, 886, 705, 546, 445, 321, 296, 348], \"SKU_Premium\": [153, 170, 169, 207, 244, 275, 402, 402, 607, 698, 602, 626, 468, 514, 336, 284, 231, 183, 188, 150], \"SKU_ShortLife\": [107, 134, 139, 159, 160, 242, 271, 403, 406, 525, 555, 473, 439, 344, 305, 226, 167, 149, 120, 129]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1429573.41} {"scenario_id": "retail_f5_storage_overflow_v2", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_storage_overflow_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 0.4835384094788184,\n \"DC2\": 0.47101793312329165,\n \"DC3\": 0.4444261116402922,\n \"DC4\": 0.45114084386799636,\n \"DC5\": 0.5403969465764372\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 342,\n 300,\n 306,\n 351,\n 369,\n 545,\n 638,\n 876,\n 1030,\n 1280,\n 1283,\n 1253,\n 1262,\n 922,\n 657,\n 550,\n 390,\n 406,\n 305,\n 289\n ],\n \"SKU_Premium\": [\n 153,\n 147,\n 148,\n 172,\n 215,\n 298,\n 383,\n 517,\n 538,\n 576,\n 597,\n 666,\n 497,\n 401,\n 373,\n 278,\n 205,\n 177,\n 185,\n 175\n ],\n \"SKU_ShortLife\": [\n 119,\n 119,\n 124,\n 137,\n 159,\n 233,\n 309,\n 416,\n 397,\n 432,\n 523,\n 454,\n 387,\n 348,\n 281,\n 219,\n 170,\n 126,\n 129,\n 128\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_storage_overflow_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\": 0.4835384094788184, \"DC2\": 0.47101793312329165, \"DC3\": 0.4444261116402922, \"DC4\": 0.45114084386799636, \"DC5\": 0.5403969465764372}, \"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\": [342, 300, 306, 351, 369, 545, 638, 876, 1030, 1280, 1283, 1253, 1262, 922, 657, 550, 390, 406, 305, 289], \"SKU_Premium\": [153, 147, 148, 172, 215, 298, 383, 517, 538, 576, 597, 666, 497, 401, 373, 278, 205, 177, 185, 175], \"SKU_ShortLife\": [119, 119, 124, 137, 159, 233, 309, 416, 397, 432, 523, 454, 387, 348, 281, 219, 170, 126, 129, 128]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1410267.58} {"scenario_id": "retail_f5_storage_overflow_v3", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_storage_overflow_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 0.4978706279165582,\n \"DC2\": 0.5592075195561181,\n \"DC3\": 0.5133389926747828,\n \"DC4\": 0.49364223464622625,\n \"DC5\": 0.5209155653446713\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 282,\n 284,\n 315,\n 387,\n 465,\n 586,\n 763,\n 934,\n 1005,\n 1102,\n 1149,\n 1212,\n 1237,\n 970,\n 609,\n 626,\n 448,\n 363,\n 307,\n 277\n ],\n \"SKU_Premium\": [\n 142,\n 161,\n 175,\n 177,\n 246,\n 303,\n 382,\n 428,\n 511,\n 625,\n 693,\n 697,\n 487,\n 488,\n 398,\n 303,\n 212,\n 166,\n 177,\n 170\n ],\n \"SKU_ShortLife\": [\n 133,\n 110,\n 149,\n 137,\n 177,\n 234,\n 279,\n 309,\n 428,\n 502,\n 573,\n 556,\n 385,\n 395,\n 301,\n 207,\n 165,\n 150,\n 133,\n 114\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_storage_overflow_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\": 0.4978706279165582, \"DC2\": 0.5592075195561181, \"DC3\": 0.5133389926747828, \"DC4\": 0.49364223464622625, \"DC5\": 0.5209155653446713}, \"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\": [282, 284, 315, 387, 465, 586, 763, 934, 1005, 1102, 1149, 1212, 1237, 970, 609, 626, 448, 363, 307, 277], \"SKU_Premium\": [142, 161, 175, 177, 246, 303, 382, 428, 511, 625, 693, 697, 487, 488, 398, 303, 212, 166, 177, 170], \"SKU_ShortLife\": [133, 110, 149, 137, 177, 234, 279, 309, 428, 502, 573, 556, 385, 395, 301, 207, 165, 150, 133, 114]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1436742.02} {"scenario_id": "retail_f5_storage_overflow_v4", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_storage_overflow\nScenario ID: retail_f5_storage_overflow_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacities are set extremely close to zero so that almost any inbound inventory risks violating capacity if not very tightly controlled. The scenario stresses whether the model correctly enforces capacity and uses waste and lost sales to maintain feasibility rather than silently overfilling locations.\n\nStructure cues:\n- The inventory and production framework is the same single-echelon system with storage constraints.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. In the JSON, cold_capacity is set to 0.5 at all locations, making this constraint extremely tight.\n- Inventory must stay non-negative and is adjusted through production, sales, and waste. In most periods, on-hand inventory must be kept very low to satisfy capacity.\n- Unmet demand becomes lost sales, and discarding inventory becomes an important decision despite its cost.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales), trading off waste and lost sales under extremely strict storage capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_storage_overflow_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 0.5072793213058784,\n \"DC2\": 0.527182818397715,\n \"DC3\": 0.49841847938150163,\n \"DC4\": 0.4891968511441707,\n \"DC5\": 0.5492548084533214\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 259,\n 282,\n 325,\n 327,\n 478,\n 529,\n 768,\n 1013,\n 978,\n 1416,\n 1459,\n 1132,\n 1099,\n 937,\n 789,\n 522,\n 451,\n 416,\n 349,\n 347\n ],\n \"SKU_Premium\": [\n 148,\n 156,\n 145,\n 201,\n 240,\n 238,\n 402,\n 499,\n 497,\n 712,\n 589,\n 665,\n 612,\n 403,\n 378,\n 295,\n 219,\n 204,\n 173,\n 133\n ],\n \"SKU_ShortLife\": [\n 110,\n 106,\n 126,\n 145,\n 199,\n 238,\n 322,\n 331,\n 452,\n 567,\n 452,\n 488,\n 453,\n 405,\n 274,\n 244,\n 193,\n 144,\n 120,\n 128\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_storage_overflow_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\": 0.5072793213058784, \"DC2\": 0.527182818397715, \"DC3\": 0.49841847938150163, \"DC4\": 0.4891968511441707, \"DC5\": 0.5492548084533214}, \"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\": [259, 282, 325, 327, 478, 529, 768, 1013, 978, 1416, 1459, 1132, 1099, 937, 789, 522, 451, 416, 349, 347], \"SKU_Premium\": [148, 156, 145, 201, 240, 238, 402, 499, 497, 712, 589, 665, 612, 403, 378, 295, 219, 204, 173, 133], \"SKU_ShortLife\": [110, 106, 126, 145, 199, 238, 322, 331, 452, 567, 452, 488, 453, 405, 274, 244, 193, 144, 120, 128]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 1464342.93} {"scenario_id": "retail_f5_strict_service_trap_v0", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_strict_service_trap_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 400.0,\n \"DC2\": 350.0,\n \"DC3\": 300.0,\n \"DC4\": 300.0,\n \"DC5\": 250.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_strict_service_trap_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\": 400.0, \"DC2\": 350.0, \"DC3\": 300.0, \"DC4\": 300.0, \"DC5\": 250.0}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 659015.8} {"scenario_id": "retail_f5_strict_service_trap_v1", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_strict_service_trap_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 415.36531199561716,\n \"DC2\": 392.9045308294742,\n \"DC3\": 292.6804991173507,\n \"DC4\": 314.97179116294683,\n \"DC5\": 217.29902282016351\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 309,\n 350,\n 295,\n 386,\n 476,\n 592,\n 783,\n 824,\n 1150,\n 1216,\n 1469,\n 1067,\n 983,\n 809,\n 604,\n 552,\n 389,\n 381,\n 352,\n 314\n ],\n \"SKU_Premium\": [\n 165,\n 147,\n 187,\n 201,\n 246,\n 266,\n 392,\n 485,\n 613,\n 596,\n 619,\n 702,\n 603,\n 514,\n 393,\n 249,\n 187,\n 202,\n 170,\n 158\n ],\n \"SKU_ShortLife\": [\n 119,\n 128,\n 126,\n 129,\n 167,\n 236,\n 316,\n 363,\n 417,\n 433,\n 581,\n 493,\n 487,\n 395,\n 289,\n 194,\n 155,\n 157,\n 140,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_strict_service_trap_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\": 415.36531199561716, \"DC2\": 392.9045308294742, \"DC3\": 292.6804991173507, \"DC4\": 314.97179116294683, \"DC5\": 217.29902282016351}, \"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, 350, 295, 386, 476, 592, 783, 824, 1150, 1216, 1469, 1067, 983, 809, 604, 552, 389, 381, 352, 314], \"SKU_Premium\": [165, 147, 187, 201, 246, 266, 392, 485, 613, 596, 619, 702, 603, 514, 393, 249, 187, 202, 170, 158], \"SKU_ShortLife\": [119, 128, 126, 129, 167, 236, 316, 363, 417, 433, 581, 493, 487, 395, 289, 194, 155, 157, 140, 119]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 667215.07} {"scenario_id": "retail_f5_strict_service_trap_v2", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_strict_service_trap_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 413.3692662122521,\n \"DC2\": 302.8622050433104,\n \"DC3\": 263.405469176275,\n \"DC4\": 309.76979674667376,\n \"DC5\": 269.4876081296507\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 325,\n 266,\n 293,\n 331,\n 426,\n 563,\n 618,\n 979,\n 1221,\n 1093,\n 1492,\n 1182,\n 1052,\n 946,\n 704,\n 567,\n 409,\n 314,\n 366,\n 308\n ],\n \"SKU_Premium\": [\n 170,\n 138,\n 155,\n 189,\n 189,\n 250,\n 383,\n 495,\n 482,\n 707,\n 666,\n 597,\n 580,\n 396,\n 337,\n 261,\n 224,\n 157,\n 174,\n 150\n ],\n \"SKU_ShortLife\": [\n 114,\n 133,\n 113,\n 146,\n 186,\n 236,\n 259,\n 401,\n 501,\n 526,\n 476,\n 508,\n 389,\n 330,\n 275,\n 192,\n 197,\n 128,\n 147,\n 133\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_strict_service_trap_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\": 413.3692662122521, \"DC2\": 302.8622050433104, \"DC3\": 263.405469176275, \"DC4\": 309.76979674667376, \"DC5\": 269.4876081296507}, \"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\": [325, 266, 293, 331, 426, 563, 618, 979, 1221, 1093, 1492, 1182, 1052, 946, 704, 567, 409, 314, 366, 308], \"SKU_Premium\": [170, 138, 155, 189, 189, 250, 383, 495, 482, 707, 666, 597, 580, 396, 337, 261, 224, 157, 174, 150], \"SKU_ShortLife\": [114, 133, 113, 146, 186, 236, 259, 401, 501, 526, 476, 508, 389, 330, 275, 192, 197, 128, 147, 133]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 671493.21} {"scenario_id": "retail_f5_strict_service_trap_v3", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_strict_service_trap_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 437.2928495743782,\n \"DC2\": 344.4049328073803,\n \"DC3\": 277.1736762390929,\n \"DC4\": 258.90632004034427,\n \"DC5\": 268.4593476264904\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 270,\n 318,\n 313,\n 409,\n 397,\n 616,\n 742,\n 1004,\n 960,\n 1381,\n 1298,\n 1149,\n 1214,\n 948,\n 610,\n 497,\n 408,\n 346,\n 284,\n 299\n ],\n \"SKU_Premium\": [\n 148,\n 156,\n 146,\n 161,\n 216,\n 297,\n 318,\n 427,\n 534,\n 646,\n 640,\n 535,\n 581,\n 444,\n 383,\n 235,\n 216,\n 183,\n 180,\n 165\n ],\n \"SKU_ShortLife\": [\n 115,\n 140,\n 141,\n 148,\n 155,\n 213,\n 318,\n 348,\n 416,\n 533,\n 541,\n 489,\n 454,\n 328,\n 312,\n 236,\n 179,\n 144,\n 139,\n 117\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_strict_service_trap_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\": 437.2928495743782, \"DC2\": 344.4049328073803, \"DC3\": 277.1736762390929, \"DC4\": 258.90632004034427, \"DC5\": 268.4593476264904}, \"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, 318, 313, 409, 397, 616, 742, 1004, 960, 1381, 1298, 1149, 1214, 948, 610, 497, 408, 346, 284, 299], \"SKU_Premium\": [148, 156, 146, 161, 216, 297, 318, 427, 534, 646, 640, 535, 581, 444, 383, 235, 216, 183, 180, 165], \"SKU_ShortLife\": [115, 140, 141, 148, 155, 213, 318, 348, 416, 533, 541, 489, 454, 328, 312, 236, 179, 144, 139, 117]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 661575.96} {"scenario_id": "retail_f5_strict_service_trap_v4", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_strict_service_trap\nScenario ID: retail_f5_strict_service_trap_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStorage capacity is reduced to the point where any attempt to maintain very high service levels conflicts with the physical constraints. The scenario is intended as a trap for models that implicitly assume near-perfect service without allowing lost sales: the only consistent solution is to accept that some demand will not be filled.\n\nStructure cues:\n- The inventory structure with production and storage capacity constraints is the same as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 10% of normal values, making these constraints very tight.\n- Inventory at each product, location, and period remains non-negative and is updated from previous stock, production, sales, and waste.\n- Unmet demand is treated as lost sales with penalties; backorders are not allowed, and there is no hard requirement that all demand be served.\n- There is no transshipment and lead times are zero. Substitution behavior remains as defined.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while recognizing that limited storage capacity makes full service impossible in some periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_strict_service_trap_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 448.477693099353,\n \"DC2\": 309.3713250925862,\n \"DC3\": 344.56164707070144,\n \"DC4\": 264.8144679890826,\n \"DC5\": 226.0599242671067\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 298,\n 349,\n 345,\n 388,\n 377,\n 528,\n 815,\n 984,\n 1054,\n 1174,\n 1160,\n 1399,\n 1021,\n 914,\n 784,\n 621,\n 453,\n 412,\n 375,\n 270\n ],\n \"SKU_Premium\": [\n 131,\n 166,\n 141,\n 166,\n 193,\n 298,\n 376,\n 488,\n 569,\n 662,\n 569,\n 686,\n 626,\n 445,\n 317,\n 239,\n 193,\n 162,\n 171,\n 139\n ],\n \"SKU_ShortLife\": [\n 113,\n 105,\n 130,\n 162,\n 198,\n 204,\n 323,\n 354,\n 406,\n 542,\n 447,\n 519,\n 390,\n 366,\n 318,\n 216,\n 188,\n 161,\n 145,\n 132\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_strict_service_trap_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\": 448.477693099353, \"DC2\": 309.3713250925862, \"DC3\": 344.56164707070144, \"DC4\": 264.8144679890826, \"DC5\": 226.0599242671067}, \"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\": [298, 349, 345, 388, 377, 528, 815, 984, 1054, 1174, 1160, 1399, 1021, 914, 784, 621, 453, 412, 375, 270], \"SKU_Premium\": [131, 166, 141, 166, 193, 298, 376, 488, 569, 662, 569, 686, 626, 445, 317, 239, 193, 162, 171, 139], \"SKU_ShortLife\": [113, 105, 130, 162, 198, 204, 323, 354, 406, 542, 447, 519, 390, 366, 318, 216, 188, 161, 145, 132]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 670873.86} {"scenario_id": "retail_f5_ultimate_stress_v0", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_ultimate_stress_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1200.0,\n \"DC2\": 1050.0,\n \"DC3\": 900.0,\n \"DC4\": 900.0,\n \"DC5\": 750.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_ultimate_stress_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\": 1200.0, \"DC2\": 1050.0, \"DC3\": 900.0, \"DC4\": 900.0, \"DC5\": 750.0}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 694823.0} {"scenario_id": "retail_f5_ultimate_stress_v1", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_ultimate_stress_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1372.9210620783708,\n \"DC2\": 1163.0419578918033,\n \"DC3\": 990.2992385996611,\n \"DC4\": 999.7078177268721,\n \"DC5\": 858.2639098144072\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 293,\n 351,\n 334,\n 399,\n 394,\n 488,\n 765,\n 915,\n 1064,\n 1119,\n 1467,\n 1179,\n 1196,\n 1011,\n 616,\n 549,\n 486,\n 418,\n 318,\n 335\n ],\n \"SKU_Premium\": [\n 152,\n 169,\n 148,\n 208,\n 219,\n 236,\n 311,\n 423,\n 542,\n 541,\n 734,\n 596,\n 504,\n 461,\n 391,\n 279,\n 242,\n 176,\n 139,\n 146\n ],\n \"SKU_ShortLife\": [\n 103,\n 123,\n 139,\n 138,\n 151,\n 193,\n 283,\n 320,\n 478,\n 460,\n 582,\n 554,\n 459,\n 390,\n 297,\n 235,\n 179,\n 135,\n 123,\n 121\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_ultimate_stress_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\": 1372.9210620783708, \"DC2\": 1163.0419578918033, \"DC3\": 990.2992385996611, \"DC4\": 999.7078177268721, \"DC5\": 858.2639098144072}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [293, 351, 334, 399, 394, 488, 765, 915, 1064, 1119, 1467, 1179, 1196, 1011, 616, 549, 486, 418, 318, 335], \"SKU_Premium\": [152, 169, 148, 208, 219, 236, 311, 423, 542, 541, 734, 596, 504, 461, 391, 279, 242, 176, 139, 146], \"SKU_ShortLife\": [103, 123, 139, 138, 151, 193, 283, 320, 478, 460, 582, 554, 459, 390, 297, 235, 179, 135, 123, 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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 686020.85} {"scenario_id": "retail_f5_ultimate_stress_v2", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_ultimate_stress_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1069.9348214422798,\n \"DC2\": 893.6696785538822,\n \"DC3\": 909.1694074955392,\n \"DC4\": 859.3260314030408,\n \"DC5\": 750.0918792230719\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 277,\n 278,\n 337,\n 321,\n 475,\n 603,\n 658,\n 1026,\n 1187,\n 1187,\n 1482,\n 1398,\n 1111,\n 1006,\n 767,\n 524,\n 384,\n 402,\n 353,\n 321\n ],\n \"SKU_Premium\": [\n 169,\n 172,\n 144,\n 167,\n 243,\n 307,\n 368,\n 403,\n 505,\n 615,\n 653,\n 567,\n 485,\n 409,\n 399,\n 234,\n 195,\n 167,\n 152,\n 152\n ],\n \"SKU_ShortLife\": [\n 110,\n 120,\n 149,\n 149,\n 199,\n 194,\n 286,\n 392,\n 397,\n 436,\n 556,\n 473,\n 456,\n 354,\n 250,\n 194,\n 200,\n 161,\n 123,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_ultimate_stress_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\": 1069.9348214422798, \"DC2\": 893.6696785538822, \"DC3\": 909.1694074955392, \"DC4\": 859.3260314030408, \"DC5\": 750.0918792230719}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [277, 278, 337, 321, 475, 603, 658, 1026, 1187, 1187, 1482, 1398, 1111, 1006, 767, 524, 384, 402, 353, 321], \"SKU_Premium\": [169, 172, 144, 167, 243, 307, 368, 403, 505, 615, 653, 567, 485, 409, 399, 234, 195, 167, 152, 152], \"SKU_ShortLife\": [110, 120, 149, 149, 199, 194, 286, 392, 397, 436, 556, 473, 456, 354, 250, 194, 200, 161, 123, 130]}, \"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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 709631.25} {"scenario_id": "retail_f5_ultimate_stress_v3", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_ultimate_stress_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1061.4575176016783,\n \"DC2\": 1075.3730828514472,\n \"DC3\": 886.7196053557647,\n \"DC4\": 1015.8158515583032,\n \"DC5\": 861.2759756685144\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 328,\n 354,\n 336,\n 336,\n 451,\n 483,\n 806,\n 867,\n 1108,\n 1094,\n 1252,\n 1197,\n 1184,\n 987,\n 623,\n 529,\n 412,\n 392,\n 360,\n 300\n ],\n \"SKU_Premium\": [\n 136,\n 165,\n 188,\n 168,\n 191,\n 313,\n 357,\n 393,\n 550,\n 573,\n 597,\n 609,\n 570,\n 391,\n 368,\n 268,\n 237,\n 188,\n 141,\n 166\n ],\n \"SKU_ShortLife\": [\n 123,\n 124,\n 135,\n 139,\n 167,\n 202,\n 257,\n 308,\n 430,\n 430,\n 448,\n 510,\n 504,\n 321,\n 312,\n 231,\n 160,\n 125,\n 128,\n 107\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_ultimate_stress_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\": 1061.4575176016783, \"DC2\": 1075.3730828514472, \"DC3\": 886.7196053557647, \"DC4\": 1015.8158515583032, \"DC5\": 861.2759756685144}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [328, 354, 336, 336, 451, 483, 806, 867, 1108, 1094, 1252, 1197, 1184, 987, 623, 529, 412, 392, 360, 300], \"SKU_Premium\": [136, 165, 188, 168, 191, 313, 357, 393, 550, 573, 597, 609, 570, 391, 368, 268, 237, 188, 141, 166], \"SKU_ShortLife\": [123, 124, 135, 139, 167, 202, 257, 308, 430, 430, 448, 510, 504, 321, 312, 231, 160, 125, 128, 107]}, \"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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 664512.16} {"scenario_id": "retail_f5_ultimate_stress_v4", "prompt_schema": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F5 (Feasibility and Model Repair)\nArchetype: retail_f5_ultimate_stress\nScenario ID: retail_f5_ultimate_stress_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThis is a composite stress test that combines three stressors: tight storage capacity, a mid-horizon production failure during a peak period, and the absence of any substitution between products. Demand is local and exogenous at each location. The scenario is designed as a boss-level test where the only viable strategy is to accept significant lost sales while respecting all physical constraints.\n\nStructure cues:\n- The archetype combines the storage bottleneck of retail_f3_storage_bottleneck (30% capacity), the peak supply failure of retail_f4_peak_failure (production=0 for periods 8-11), and the no-substitution structure of retail_f2_no_substitution (sub_edges=[]).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 30% of normal values and must be enforced as binding constraints.\n- Production capacities are set to zero during a mid-horizon peak window (periods 8-11), so no new units can be produced in those periods.\n- The substitution graph is empty (sub_edges = []), so each product's demand can only be served by its own inventory at the location.\n- Inventory at each product, location, and period remains non-negative and reflects previous stock, allowed production, sales, and waste. Unmet demand is explicitly treated as lost sales.\n- There is no transshipment and lead times are zero. Labor capacity remains generous.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while handling simultaneous capacity, supply, and assortment stress without violating feasibility.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f5_ultimate_stress_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 1245.7612591232007,\n \"DC2\": 934.2263218142887,\n \"DC3\": 776.9531098553176,\n \"DC4\": 906.3082692867368,\n \"DC5\": 653.3097517197237\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 0,\n 0,\n 0,\n 0,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 0,\n 0,\n 0,\n 0,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 0,\n 0,\n 0,\n 0,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 265,\n 277,\n 294,\n 320,\n 425,\n 550,\n 806,\n 951,\n 1211,\n 1327,\n 1333,\n 1392,\n 1218,\n 982,\n 744,\n 530,\n 473,\n 318,\n 322,\n 286\n ],\n \"SKU_Premium\": [\n 149,\n 139,\n 180,\n 205,\n 226,\n 308,\n 333,\n 456,\n 489,\n 659,\n 721,\n 640,\n 555,\n 440,\n 325,\n 260,\n 225,\n 197,\n 163,\n 167\n ],\n \"SKU_ShortLife\": [\n 114,\n 119,\n 114,\n 139,\n 179,\n 210,\n 266,\n 330,\n 441,\n 566,\n 525,\n 494,\n 418,\n 311,\n 273,\n 224,\n 151,\n 167,\n 124,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f5_ultimate_stress_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\": 1245.7612591232007, \"DC2\": 934.2263218142887, \"DC3\": 776.9531098553176, \"DC4\": 906.3082692867368, \"DC5\": 653.3097517197237}, \"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, 0, 0, 0, 0, 800, 800, 800, 800, 800, 800, 800, 800], \"SKU_Premium\": [400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400], \"SKU_ShortLife\": [500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 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\": [265, 277, 294, 320, 425, 550, 806, 951, 1211, 1327, 1333, 1392, 1218, 982, 744, 530, 473, 318, 322, 286], \"SKU_Premium\": [149, 139, 180, 205, 226, 308, 333, 456, 489, 659, 721, 640, 555, 440, 325, 260, 225, 197, 163, 167], \"SKU_ShortLife\": [114, 119, 114, 139, 179, 210, 266, 330, 441, 566, 525, 494, 418, 311, 273, 224, 151, 167, 124, 106]}, \"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\": [], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 736925.88} {"scenario_id": "retail_f6_fixed_order_cost_v0", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_fixed_order_cost_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 5000.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_fixed_order_cost_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\": 5000.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\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 755550.05} {"scenario_id": "retail_f6_fixed_order_cost_v1", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_fixed_order_cost_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3698.4076989093614,\n \"DC2\": 3221.606370420646,\n \"DC3\": 2914.9829417453325,\n \"DC4\": 3196.1474214548466,\n \"DC5\": 2130.6427526847997\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 264,\n 356,\n 331,\n 341,\n 488,\n 573,\n 732,\n 932,\n 1039,\n 1419,\n 1412,\n 1071,\n 1250,\n 785,\n 773,\n 545,\n 451,\n 363,\n 329,\n 336\n ],\n \"SKU_Premium\": [\n 149,\n 148,\n 172,\n 178,\n 212,\n 252,\n 314,\n 509,\n 474,\n 654,\n 585,\n 662,\n 629,\n 489,\n 361,\n 286,\n 235,\n 165,\n 142,\n 146\n ],\n \"SKU_ShortLife\": [\n 123,\n 137,\n 114,\n 139,\n 173,\n 246,\n 264,\n 366,\n 501,\n 556,\n 475,\n 529,\n 445,\n 333,\n 283,\n 235,\n 147,\n 143,\n 121,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 5000.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_fixed_order_cost_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\": 3698.4076989093614, \"DC2\": 3221.606370420646, \"DC3\": 2914.9829417453325, \"DC4\": 3196.1474214548466, \"DC5\": 2130.6427526847997}, \"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\": [264, 356, 331, 341, 488, 573, 732, 932, 1039, 1419, 1412, 1071, 1250, 785, 773, 545, 451, 363, 329, 336], \"SKU_Premium\": [149, 148, 172, 178, 212, 252, 314, 509, 474, 654, 585, 662, 629, 489, 361, 286, 235, 165, 142, 146], \"SKU_ShortLife\": [123, 137, 114, 139, 173, 246, 264, 366, 501, 556, 475, 529, 445, 333, 283, 235, 147, 143, 121, 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\": 5000.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\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 768101.67} {"scenario_id": "retail_f6_fixed_order_cost_v2", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_fixed_order_cost_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3784.3594552371787,\n \"DC2\": 3050.8838043658684,\n \"DC3\": 2958.256324682057,\n \"DC4\": 3019.9622298108116,\n \"DC5\": 2626.6651299733194\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 299,\n 289,\n 338,\n 406,\n 444,\n 490,\n 707,\n 962,\n 1160,\n 1394,\n 1436,\n 1394,\n 1013,\n 1040,\n 806,\n 502,\n 385,\n 384,\n 344,\n 323\n ],\n \"SKU_Premium\": [\n 150,\n 138,\n 178,\n 161,\n 230,\n 278,\n 370,\n 412,\n 521,\n 581,\n 559,\n 646,\n 565,\n 469,\n 327,\n 279,\n 242,\n 184,\n 152,\n 163\n ],\n \"SKU_ShortLife\": [\n 134,\n 113,\n 115,\n 150,\n 183,\n 213,\n 259,\n 343,\n 390,\n 481,\n 527,\n 469,\n 495,\n 415,\n 266,\n 228,\n 160,\n 160,\n 123,\n 125\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 5000.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_fixed_order_cost_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\": 3784.3594552371787, \"DC2\": 3050.8838043658684, \"DC3\": 2958.256324682057, \"DC4\": 3019.9622298108116, \"DC5\": 2626.6651299733194}, \"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\": [299, 289, 338, 406, 444, 490, 707, 962, 1160, 1394, 1436, 1394, 1013, 1040, 806, 502, 385, 384, 344, 323], \"SKU_Premium\": [150, 138, 178, 161, 230, 278, 370, 412, 521, 581, 559, 646, 565, 469, 327, 279, 242, 184, 152, 163], \"SKU_ShortLife\": [134, 113, 115, 150, 183, 213, 259, 343, 390, 481, 527, 469, 495, 415, 266, 228, 160, 160, 123, 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\": 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\": 5000.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\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 766436.12} {"scenario_id": "retail_f6_fixed_order_cost_v3", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_fixed_order_cost_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4143.653398229666,\n \"DC2\": 3776.3132389635057,\n \"DC3\": 2703.2209165199765,\n \"DC4\": 2628.458044958376,\n \"DC5\": 2745.4421753833303\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 288,\n 322,\n 360,\n 331,\n 380,\n 555,\n 756,\n 886,\n 943,\n 1191,\n 1169,\n 1334,\n 1216,\n 1014,\n 816,\n 467,\n 397,\n 333,\n 344,\n 298\n ],\n \"SKU_Premium\": [\n 168,\n 141,\n 141,\n 186,\n 232,\n 269,\n 388,\n 423,\n 605,\n 640,\n 732,\n 626,\n 476,\n 514,\n 378,\n 279,\n 247,\n 163,\n 147,\n 167\n ],\n \"SKU_ShortLife\": [\n 104,\n 114,\n 143,\n 160,\n 176,\n 220,\n 261,\n 399,\n 442,\n 499,\n 472,\n 438,\n 425,\n 385,\n 308,\n 242,\n 172,\n 132,\n 133,\n 113\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 5000.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_fixed_order_cost_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\": 4143.653398229666, \"DC2\": 3776.3132389635057, \"DC3\": 2703.2209165199765, \"DC4\": 2628.458044958376, \"DC5\": 2745.4421753833303}, \"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\": [288, 322, 360, 331, 380, 555, 756, 886, 943, 1191, 1169, 1334, 1216, 1014, 816, 467, 397, 333, 344, 298], \"SKU_Premium\": [168, 141, 141, 186, 232, 269, 388, 423, 605, 640, 732, 626, 476, 514, 378, 279, 247, 163, 147, 167], \"SKU_ShortLife\": [104, 114, 143, 160, 176, 220, 261, 399, 442, 499, 472, 438, 425, 385, 308, 242, 172, 132, 133, 113]}, \"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\": 5000.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\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 764703.38} {"scenario_id": "retail_f6_fixed_order_cost_v4", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_fixed_order_cost\nScenario ID: retail_f6_fixed_order_cost_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nPlacing an order in a period incurs a fixed cost regardless of how large the order is. This encourages batching orders into fewer, larger replenishments instead of many small ones. The retailer still faces local demand, storage limits, and lost sales for unmet demand, but now each decision to place any positive order carries an additional setup-like cost.\n\nStructure cues:\n- The structure is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON includes fixed_order=5000 in the \"costs\" object. Whenever a strictly positive order is placed for a product at a location in a period, this fixed cost must be charged once for that product-location-period in addition to variable purchasing costs.\n- The model must ensure that the fixed cost is applied if and only if the total order quantity for a product at a location in a period is positive; it should not be possible to evade the fixed cost with arbitrarily small orders.\n- Inventory balance under zero lead time is standard: on-hand stock is updated from previous stock and current orders, minus sales and waste, and cannot drop below zero.\n- There is no transshipment, lead times are zero, and substitution behavior is unchanged.\n- The objective is to minimize total cost including purchasing, fixed ordering, holding, waste, and lost sales costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_fixed_order_cost_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3880.1559701552037,\n \"DC2\": 3784.1766372139246,\n \"DC3\": 3093.9524291712028,\n \"DC4\": 2785.6630083352834,\n \"DC5\": 2449.4972692946662\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 337,\n 291,\n 305,\n 312,\n 424,\n 523,\n 796,\n 914,\n 1009,\n 1125,\n 1209,\n 1300,\n 1148,\n 1020,\n 612,\n 611,\n 374,\n 364,\n 373,\n 347\n ],\n \"SKU_Premium\": [\n 148,\n 164,\n 145,\n 171,\n 208,\n 272,\n 383,\n 457,\n 629,\n 571,\n 570,\n 666,\n 623,\n 476,\n 366,\n 263,\n 224,\n 164,\n 161,\n 150\n ],\n \"SKU_ShortLife\": [\n 105,\n 114,\n 127,\n 150,\n 196,\n 239,\n 266,\n 339,\n 492,\n 508,\n 467,\n 543,\n 475,\n 336,\n 266,\n 238,\n 158,\n 151,\n 139,\n 110\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 5000.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_fixed_order_cost_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\": 3880.1559701552037, \"DC2\": 3784.1766372139246, \"DC3\": 3093.9524291712028, \"DC4\": 2785.6630083352834, \"DC5\": 2449.4972692946662}, \"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\": [337, 291, 305, 312, 424, 523, 796, 914, 1009, 1125, 1209, 1300, 1148, 1020, 612, 611, 374, 364, 373, 347], \"SKU_Premium\": [148, 164, 145, 171, 208, 272, 383, 457, 629, 571, 570, 666, 623, 476, 366, 263, 224, 164, 161, 150], \"SKU_ShortLife\": [105, 114, 127, 150, 196, 239, 266, 339, 492, 508, 467, 543, 475, 336, 266, 238, 158, 151, 139, 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\": 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\": 5000.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\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 759745.35} {"scenario_id": "retail_f6_lead_time_v0", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_lead_time_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 3,\n \"SKU_Premium\": 4,\n \"SKU_ShortLife\": 2\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_lead_time_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\": 3, \"SKU_Premium\": 4, \"SKU_ShortLife\": 2}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 528518.0} {"scenario_id": "retail_f6_lead_time_v1", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_lead_time_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 3,\n \"SKU_Premium\": 4,\n \"SKU_ShortLife\": 2\n },\n \"cold_capacity\": {\n \"DC1\": 3450.4353036741823,\n \"DC2\": 3127.2498344214428,\n \"DC3\": 2604.0418269037436,\n \"DC4\": 3037.756928539447,\n \"DC5\": 2139.75538580218\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 317,\n 295,\n 309,\n 329,\n 456,\n 493,\n 769,\n 799,\n 988,\n 1181,\n 1258,\n 1253,\n 1062,\n 817,\n 649,\n 614,\n 447,\n 405,\n 297,\n 331\n ],\n \"SKU_Premium\": [\n 132,\n 146,\n 184,\n 179,\n 209,\n 250,\n 317,\n 450,\n 560,\n 556,\n 624,\n 618,\n 493,\n 450,\n 311,\n 268,\n 191,\n 170,\n 140,\n 150\n ],\n \"SKU_ShortLife\": [\n 132,\n 139,\n 137,\n 134,\n 162,\n 228,\n 306,\n 370,\n 470,\n 572,\n 463,\n 556,\n 425,\n 314,\n 254,\n 195,\n 171,\n 133,\n 122,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_lead_time_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\": 3, \"SKU_Premium\": 4, \"SKU_ShortLife\": 2}, \"cold_capacity\": {\"DC1\": 3450.4353036741823, \"DC2\": 3127.2498344214428, \"DC3\": 2604.0418269037436, \"DC4\": 3037.756928539447, \"DC5\": 2139.75538580218}, \"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\": [317, 295, 309, 329, 456, 493, 769, 799, 988, 1181, 1258, 1253, 1062, 817, 649, 614, 447, 405, 297, 331], \"SKU_Premium\": [132, 146, 184, 179, 209, 250, 317, 450, 560, 556, 624, 618, 493, 450, 311, 268, 191, 170, 140, 150], \"SKU_ShortLife\": [132, 139, 137, 134, 162, 228, 306, 370, 470, 572, 463, 556, 425, 314, 254, 195, 171, 133, 122, 119]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 486598.0} {"scenario_id": "retail_f6_lead_time_v2", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_lead_time_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 3,\n \"SKU_Premium\": 4,\n \"SKU_ShortLife\": 2\n },\n \"cold_capacity\": {\n \"DC1\": 3704.9168584483773,\n \"DC2\": 3673.223489783482,\n \"DC3\": 3438.964145917274,\n \"DC4\": 3055.7624683413997,\n \"DC5\": 2285.9916818661613\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 338,\n 333,\n 288,\n 342,\n 482,\n 574,\n 681,\n 935,\n 964,\n 1411,\n 1220,\n 1203,\n 1213,\n 782,\n 810,\n 628,\n 483,\n 319,\n 294,\n 325\n ],\n \"SKU_Premium\": [\n 162,\n 145,\n 148,\n 182,\n 208,\n 254,\n 312,\n 520,\n 473,\n 578,\n 630,\n 667,\n 480,\n 516,\n 325,\n 277,\n 199,\n 202,\n 152,\n 137\n ],\n \"SKU_ShortLife\": [\n 105,\n 105,\n 135,\n 137,\n 181,\n 193,\n 299,\n 386,\n 388,\n 530,\n 467,\n 467,\n 413,\n 362,\n 320,\n 208,\n 166,\n 130,\n 127,\n 117\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_lead_time_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\": 3, \"SKU_Premium\": 4, \"SKU_ShortLife\": 2}, \"cold_capacity\": {\"DC1\": 3704.9168584483773, \"DC2\": 3673.223489783482, \"DC3\": 3438.964145917274, \"DC4\": 3055.7624683413997, \"DC5\": 2285.9916818661613}, \"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\": [338, 333, 288, 342, 482, 574, 681, 935, 964, 1411, 1220, 1203, 1213, 782, 810, 628, 483, 319, 294, 325], \"SKU_Premium\": [162, 145, 148, 182, 208, 254, 312, 520, 473, 578, 630, 667, 480, 516, 325, 277, 199, 202, 152, 137], \"SKU_ShortLife\": [105, 105, 135, 137, 181, 193, 299, 386, 388, 530, 467, 467, 413, 362, 320, 208, 166, 130, 127, 117]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 514981.0} {"scenario_id": "retail_f6_lead_time_v3", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_lead_time_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 3,\n \"SKU_Premium\": 4,\n \"SKU_ShortLife\": 2\n },\n \"cold_capacity\": {\n \"DC1\": 4125.421929653238,\n \"DC2\": 3509.5706550023788,\n \"DC3\": 2809.690108330368,\n \"DC4\": 3043.527198117899,\n \"DC5\": 2139.941010902774\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 299,\n 302,\n 281,\n 351,\n 430,\n 582,\n 776,\n 1035,\n 985,\n 1227,\n 1338,\n 1135,\n 1201,\n 868,\n 729,\n 505,\n 445,\n 400,\n 359,\n 273\n ],\n \"SKU_Premium\": [\n 146,\n 151,\n 156,\n 183,\n 184,\n 298,\n 380,\n 403,\n 482,\n 654,\n 587,\n 597,\n 508,\n 452,\n 331,\n 299,\n 210,\n 160,\n 140,\n 173\n ],\n \"SKU_ShortLife\": [\n 131,\n 120,\n 132,\n 130,\n 194,\n 198,\n 296,\n 381,\n 384,\n 480,\n 512,\n 479,\n 494,\n 374,\n 276,\n 189,\n 189,\n 151,\n 141,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_lead_time_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\": 3, \"SKU_Premium\": 4, \"SKU_ShortLife\": 2}, \"cold_capacity\": {\"DC1\": 4125.421929653238, \"DC2\": 3509.5706550023788, \"DC3\": 2809.690108330368, \"DC4\": 3043.527198117899, \"DC5\": 2139.941010902774}, \"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\": [299, 302, 281, 351, 430, 582, 776, 1035, 985, 1227, 1338, 1135, 1201, 868, 729, 505, 445, 400, 359, 273], \"SKU_Premium\": [146, 151, 156, 183, 184, 298, 380, 403, 482, 654, 587, 597, 508, 452, 331, 299, 210, 160, 140, 173], \"SKU_ShortLife\": [131, 120, 132, 130, 194, 198, 296, 381, 384, 480, 512, 479, 494, 374, 276, 189, 189, 151, 141, 106]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 510229.0} {"scenario_id": "retail_f6_lead_time_v4", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_lead_time\nScenario ID: retail_f6_lead_time_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders for each product take several periods to arrive. When the retailer places an order, the goods travel in a pipeline and only become available to serve demand after a deterministic lead time that is specific to each product. Demand is local and exogenous; customers are never backordered, so demand that cannot be met by on-hand inventory in a period is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON provides non-zero lead times: SKU_Basic=3, SKU_Premium=4, SKU_ShortLife=2 periods. Orders placed now will only enter on-hand inventory after the corresponding lead time has elapsed.\n- Inventory must distinguish between on-hand units and units that are still in transit. Only on-hand units can be used to satisfy demand in a given period; in-transit units become on-hand when their lead time completes.\n- For each product and location, on-hand stock in a period is determined by previous on-hand stock plus arrivals of past orders whose lead time has completed, minus sales and waste. Stock levels must remain non-negative.\n- Substitution behavior, absence of transshipment, and generous labor capacity remain consistent with other families.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while explicitly capturing the effect of deterministic lead times on inventory decisions.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_lead_time_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 3,\n \"SKU_Premium\": 4,\n \"SKU_ShortLife\": 2\n },\n \"cold_capacity\": {\n \"DC1\": 3953.1566123878124,\n \"DC2\": 3946.3308271816686,\n \"DC3\": 2914.015316475643,\n \"DC4\": 2681.146011059718,\n \"DC5\": 2666.5408489893634\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 325,\n 271,\n 345,\n 347,\n 418,\n 630,\n 806,\n 840,\n 1015,\n 1230,\n 1378,\n 1133,\n 985,\n 961,\n 772,\n 561,\n 453,\n 354,\n 361,\n 296\n ],\n \"SKU_Premium\": [\n 129,\n 159,\n 170,\n 171,\n 193,\n 250,\n 312,\n 433,\n 506,\n 533,\n 577,\n 550,\n 624,\n 516,\n 378,\n 234,\n 184,\n 183,\n 140,\n 176\n ],\n \"SKU_ShortLife\": [\n 105,\n 110,\n 119,\n 147,\n 199,\n 198,\n 293,\n 368,\n 465,\n 511,\n 476,\n 561,\n 441,\n 389,\n 293,\n 234,\n 188,\n 166,\n 126,\n 123\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_lead_time_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\": 3, \"SKU_Premium\": 4, \"SKU_ShortLife\": 2}, \"cold_capacity\": {\"DC1\": 3953.1566123878124, \"DC2\": 3946.3308271816686, \"DC3\": 2914.015316475643, \"DC4\": 2681.146011059718, \"DC5\": 2666.5408489893634}, \"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\": [325, 271, 345, 347, 418, 630, 806, 840, 1015, 1230, 1378, 1133, 985, 961, 772, 561, 453, 354, 361, 296], \"SKU_Premium\": [129, 159, 170, 171, 193, 250, 312, 433, 506, 533, 577, 550, 624, 516, 378, 234, 184, 183, 140, 176], \"SKU_ShortLife\": [105, 110, 119, 147, 199, 198, 293, 368, 465, 511, 476, 561, 441, 389, 293, 234, 188, 166, 126, 123]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 502283.0} {"scenario_id": "retail_f6_moq_binary_v0", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_moq_binary_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 300,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_moq_binary_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\": 300, \"pack_size\": 1, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 506120.72} {"scenario_id": "retail_f6_moq_binary_v1", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_moq_binary_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3517.2831971418095,\n \"DC2\": 2993.3553003156903,\n \"DC3\": 2955.8209971499678,\n \"DC4\": 2730.0141062733587,\n \"DC5\": 2496.958716507957\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 268,\n 344,\n 288,\n 322,\n 373,\n 589,\n 632,\n 779,\n 1248,\n 1344,\n 1245,\n 1380,\n 1258,\n 951,\n 704,\n 531,\n 465,\n 368,\n 335,\n 281\n ],\n \"SKU_Premium\": [\n 161,\n 159,\n 171,\n 200,\n 213,\n 268,\n 308,\n 517,\n 511,\n 674,\n 723,\n 547,\n 586,\n 424,\n 311,\n 302,\n 211,\n 182,\n 185,\n 146\n ],\n \"SKU_ShortLife\": [\n 119,\n 123,\n 117,\n 124,\n 164,\n 223,\n 268,\n 320,\n 397,\n 438,\n 597,\n 426,\n 378,\n 414,\n 302,\n 249,\n 149,\n 144,\n 120,\n 133\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 300,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_moq_binary_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\": 3517.2831971418095, \"DC2\": 2993.3553003156903, \"DC3\": 2955.8209971499678, \"DC4\": 2730.0141062733587, \"DC5\": 2496.958716507957}, \"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, 344, 288, 322, 373, 589, 632, 779, 1248, 1344, 1245, 1380, 1258, 951, 704, 531, 465, 368, 335, 281], \"SKU_Premium\": [161, 159, 171, 200, 213, 268, 308, 517, 511, 674, 723, 547, 586, 424, 311, 302, 211, 182, 185, 146], \"SKU_ShortLife\": [119, 123, 117, 124, 164, 223, 268, 320, 397, 438, 597, 426, 378, 414, 302, 249, 149, 144, 120, 133]}, \"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\": 300, \"pack_size\": 1, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 511116.43} {"scenario_id": "retail_f6_moq_binary_v2", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_moq_binary_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3591.3562689619716,\n \"DC2\": 4023.32056023795,\n \"DC3\": 3270.4019726775223,\n \"DC4\": 3309.4597507470958,\n \"DC5\": 2411.5065323850895\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 295,\n 278,\n 291,\n 406,\n 488,\n 534,\n 617,\n 859,\n 1008,\n 1150,\n 1153,\n 1302,\n 1205,\n 845,\n 720,\n 479,\n 499,\n 348,\n 362,\n 345\n ],\n \"SKU_Premium\": [\n 157,\n 147,\n 146,\n 177,\n 184,\n 245,\n 390,\n 467,\n 543,\n 591,\n 614,\n 617,\n 486,\n 447,\n 305,\n 273,\n 217,\n 175,\n 175,\n 143\n ],\n \"SKU_ShortLife\": [\n 116,\n 123,\n 136,\n 140,\n 166,\n 208,\n 300,\n 334,\n 399,\n 441,\n 580,\n 565,\n 436,\n 398,\n 274,\n 249,\n 191,\n 137,\n 144,\n 140\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 300,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_moq_binary_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\": 3591.3562689619716, \"DC2\": 4023.32056023795, \"DC3\": 3270.4019726775223, \"DC4\": 3309.4597507470958, \"DC5\": 2411.5065323850895}, \"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\": [295, 278, 291, 406, 488, 534, 617, 859, 1008, 1150, 1153, 1302, 1205, 845, 720, 479, 499, 348, 362, 345], \"SKU_Premium\": [157, 147, 146, 177, 184, 245, 390, 467, 543, 591, 614, 617, 486, 447, 305, 273, 217, 175, 175, 143], \"SKU_ShortLife\": [116, 123, 136, 140, 166, 208, 300, 334, 399, 441, 580, 565, 436, 398, 274, 249, 191, 137, 144, 140]}, \"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\": 300, \"pack_size\": 1, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 486970.87} {"scenario_id": "retail_f6_moq_binary_v3", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_moq_binary_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4049.2569240776834,\n \"DC2\": 3115.4067599332375,\n \"DC3\": 3022.491600197454,\n \"DC4\": 3066.6803137444417,\n \"DC5\": 2218.1353433861004\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 329,\n 339,\n 327,\n 413,\n 369,\n 614,\n 708,\n 770,\n 969,\n 1228,\n 1393,\n 1412,\n 1011,\n 926,\n 733,\n 612,\n 437,\n 361,\n 303,\n 304\n ],\n \"SKU_Premium\": [\n 165,\n 167,\n 187,\n 166,\n 191,\n 297,\n 318,\n 393,\n 621,\n 692,\n 555,\n 641,\n 585,\n 505,\n 386,\n 291,\n 211,\n 189,\n 139,\n 168\n ],\n \"SKU_ShortLife\": [\n 122,\n 118,\n 135,\n 138,\n 182,\n 229,\n 259,\n 309,\n 387,\n 504,\n 583,\n 462,\n 491,\n 326,\n 244,\n 222,\n 160,\n 162,\n 150,\n 127\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 300,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_moq_binary_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\": 4049.2569240776834, \"DC2\": 3115.4067599332375, \"DC3\": 3022.491600197454, \"DC4\": 3066.6803137444417, \"DC5\": 2218.1353433861004}, \"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\": [329, 339, 327, 413, 369, 614, 708, 770, 969, 1228, 1393, 1412, 1011, 926, 733, 612, 437, 361, 303, 304], \"SKU_Premium\": [165, 167, 187, 166, 191, 297, 318, 393, 621, 692, 555, 641, 585, 505, 386, 291, 211, 189, 139, 168], \"SKU_ShortLife\": [122, 118, 135, 138, 182, 229, 259, 309, 387, 504, 583, 462, 491, 326, 244, 222, 160, 162, 150, 127]}, \"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\": 300, \"pack_size\": 1, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 514497.87} {"scenario_id": "retail_f6_moq_binary_v4", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_moq_binary\nScenario ID: retail_f6_moq_binary_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a minimum order quantity applied uniformly across the category. In any period, the buyer must either place no order for a product or place an order that is at least as large as the specified global minimum. It is never allowed to place a small positive order below that threshold. This creates an all-or-nothing structure in procurement decisions on top of the usual inventory and storage logic.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies moq=300 in the \"constraints\" object. For each product, location, and period, the order quantity must either be zero or at least 300; intermediate positive quantities below moq are forbidden.\n- This all-or-nothing pattern must be enforced consistently across products, locations, and periods so that the model does not exploit fractional orders below the global minimum.\n- Inventory balance follows the standard pattern with zero lead time: on-hand stock in a period comes from previous stock and current orders, minus sales and waste, and cannot become negative.\n- There is no transshipment; substitution behavior follows the JSON graph, and labor capacity is generous.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and the implicit cost of being forced to buy in minimum lots.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_moq_binary_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4333.68165723768,\n \"DC2\": 3049.0074059309536,\n \"DC3\": 3204.0667208398204,\n \"DC4\": 3364.3402185588516,\n \"DC5\": 2775.543106413331\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 328,\n 348,\n 329,\n 375,\n 492,\n 626,\n 624,\n 881,\n 1163,\n 1409,\n 1396,\n 1223,\n 1041,\n 783,\n 744,\n 507,\n 412,\n 359,\n 352,\n 307\n ],\n \"SKU_Premium\": [\n 142,\n 155,\n 154,\n 176,\n 232,\n 314,\n 368,\n 390,\n 539,\n 666,\n 565,\n 655,\n 603,\n 433,\n 303,\n 297,\n 216,\n 197,\n 186,\n 133\n ],\n \"SKU_ShortLife\": [\n 129,\n 114,\n 138,\n 164,\n 193,\n 233,\n 256,\n 331,\n 440,\n 432,\n 541,\n 510,\n 500,\n 368,\n 326,\n 189,\n 148,\n 154,\n 142,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 300,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_moq_binary_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\": 4333.68165723768, \"DC2\": 3049.0074059309536, \"DC3\": 3204.0667208398204, \"DC4\": 3364.3402185588516, \"DC5\": 2775.543106413331}, \"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\": [328, 348, 329, 375, 492, 626, 624, 881, 1163, 1409, 1396, 1223, 1041, 783, 744, 507, 412, 359, 352, 307], \"SKU_Premium\": [142, 155, 154, 176, 232, 314, 368, 390, 539, 666, 565, 655, 603, 433, 303, 297, 216, 197, 186, 133], \"SKU_ShortLife\": [129, 114, 138, 164, 193, 233, 256, 331, 440, 432, 541, 510, 500, 368, 326, 189, 148, 154, 142, 119]}, \"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\": 300, \"pack_size\": 1, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 510333.63} {"scenario_id": "retail_f6_pack_size_integer_v0", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_pack_size_integer_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 100,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_pack_size_integer_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\": 100, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 399680.25} {"scenario_id": "retail_f6_pack_size_integer_v1", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_pack_size_integer_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3590.7274666787425,\n \"DC2\": 3086.6753752385603,\n \"DC3\": 2813.3037312820097,\n \"DC4\": 3182.7098958181746,\n \"DC5\": 2864.0933210396124\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 288,\n 320,\n 338,\n 385,\n 452,\n 620,\n 676,\n 971,\n 1193,\n 1139,\n 1271,\n 1350,\n 1003,\n 779,\n 623,\n 604,\n 418,\n 405,\n 287,\n 287\n ],\n \"SKU_Premium\": [\n 130,\n 139,\n 186,\n 203,\n 191,\n 308,\n 372,\n 406,\n 474,\n 637,\n 659,\n 682,\n 556,\n 482,\n 369,\n 249,\n 235,\n 192,\n 183,\n 141\n ],\n \"SKU_ShortLife\": [\n 138,\n 121,\n 122,\n 159,\n 153,\n 225,\n 247,\n 382,\n 505,\n 424,\n 456,\n 547,\n 489,\n 368,\n 265,\n 205,\n 195,\n 140,\n 126,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 100,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_pack_size_integer_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\": 3590.7274666787425, \"DC2\": 3086.6753752385603, \"DC3\": 2813.3037312820097, \"DC4\": 3182.7098958181746, \"DC5\": 2864.0933210396124}, \"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\": [288, 320, 338, 385, 452, 620, 676, 971, 1193, 1139, 1271, 1350, 1003, 779, 623, 604, 418, 405, 287, 287], \"SKU_Premium\": [130, 139, 186, 203, 191, 308, 372, 406, 474, 637, 659, 682, 556, 482, 369, 249, 235, 192, 183, 141], \"SKU_ShortLife\": [138, 121, 122, 159, 153, 225, 247, 382, 505, 424, 456, 547, 489, 368, 265, 205, 195, 140, 126, 130]}, \"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\": 100, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 399656.42} {"scenario_id": "retail_f6_pack_size_integer_v2", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_pack_size_integer_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4084.4510245669053,\n \"DC2\": 3180.359104130025,\n \"DC3\": 3276.049752312658,\n \"DC4\": 2987.537049957589,\n \"DC5\": 2871.0733550189802\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 304,\n 335,\n 353,\n 399,\n 387,\n 486,\n 811,\n 936,\n 1253,\n 1203,\n 1429,\n 1083,\n 1119,\n 918,\n 787,\n 563,\n 436,\n 403,\n 329,\n 312\n ],\n \"SKU_Premium\": [\n 155,\n 152,\n 164,\n 169,\n 224,\n 311,\n 408,\n 434,\n 621,\n 640,\n 720,\n 595,\n 526,\n 412,\n 325,\n 233,\n 197,\n 164,\n 154,\n 147\n ],\n \"SKU_ShortLife\": [\n 112,\n 119,\n 141,\n 144,\n 150,\n 221,\n 292,\n 373,\n 390,\n 469,\n 482,\n 547,\n 471,\n 387,\n 310,\n 196,\n 165,\n 144,\n 140,\n 136\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 100,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_pack_size_integer_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\": 4084.4510245669053, \"DC2\": 3180.359104130025, \"DC3\": 3276.049752312658, \"DC4\": 2987.537049957589, \"DC5\": 2871.0733550189802}, \"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\": [304, 335, 353, 399, 387, 486, 811, 936, 1253, 1203, 1429, 1083, 1119, 918, 787, 563, 436, 403, 329, 312], \"SKU_Premium\": [155, 152, 164, 169, 224, 311, 408, 434, 621, 640, 720, 595, 526, 412, 325, 233, 197, 164, 154, 147], \"SKU_ShortLife\": [112, 119, 141, 144, 150, 221, 292, 373, 390, 469, 482, 547, 471, 387, 310, 196, 165, 144, 140, 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\": 100, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 407555.67} {"scenario_id": "retail_f6_pack_size_integer_v3", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_pack_size_integer_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4232.072628584782,\n \"DC2\": 3799.3601677924116,\n \"DC3\": 3132.5947863620945,\n \"DC4\": 3011.9890825784305,\n \"DC5\": 2207.177251010999\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 269,\n 316,\n 299,\n 382,\n 403,\n 572,\n 723,\n 917,\n 1149,\n 1231,\n 1472,\n 1210,\n 1240,\n 921,\n 671,\n 600,\n 405,\n 314,\n 297,\n 334\n ],\n \"SKU_Premium\": [\n 145,\n 134,\n 163,\n 205,\n 219,\n 311,\n 395,\n 420,\n 556,\n 568,\n 732,\n 553,\n 498,\n 509,\n 313,\n 295,\n 244,\n 174,\n 169,\n 158\n ],\n \"SKU_ShortLife\": [\n 123,\n 107,\n 147,\n 134,\n 170,\n 221,\n 258,\n 363,\n 404,\n 445,\n 482,\n 486,\n 490,\n 407,\n 274,\n 245,\n 194,\n 148,\n 128,\n 136\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 100,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_pack_size_integer_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\": 4232.072628584782, \"DC2\": 3799.3601677924116, \"DC3\": 3132.5947863620945, \"DC4\": 3011.9890825784305, \"DC5\": 2207.177251010999}, \"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\": [269, 316, 299, 382, 403, 572, 723, 917, 1149, 1231, 1472, 1210, 1240, 921, 671, 600, 405, 314, 297, 334], \"SKU_Premium\": [145, 134, 163, 205, 219, 311, 395, 420, 556, 568, 732, 553, 498, 509, 313, 295, 244, 174, 169, 158], \"SKU_ShortLife\": [123, 107, 147, 134, 170, 221, 258, 363, 404, 445, 482, 486, 490, 407, 274, 245, 194, 148, 128, 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\": 100, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 403105.47} {"scenario_id": "retail_f6_pack_size_integer_v4", "prompt_schema": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F6 (Logistics and Integer Procurement)\nArchetype: retail_f6_pack_size_integer\nScenario ID: retail_f6_pack_size_integer_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nOrders must be placed in whole packs or pallets of a fixed size. The retailer can only buy an integer number of packs; partial packs cannot be ordered. Demand and storage remain as before, and demand that cannot be served from on-hand inventory is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with ordering decisions, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies pack_size=100 in the \"constraints\" object. In every period, the order quantity for each product at each location must be a whole number of packs (multiples of 100).\n- This pack-size rule introduces integrality into order quantities and must be enforced consistently for all products and periods using the same pack size.\n- Inventory balance with zero lead time is standard: on-hand stock comes from previous stock and ordered units, minus sales and waste, and remains non-negative.\n- There is no transshipment, lead times are zero, and substitution behavior follows the JSON graph.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the pack-size ordering restriction.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f6_pack_size_integer_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4415.927385224888,\n \"DC2\": 3462.031052814994,\n \"DC3\": 2705.5936007124646,\n \"DC4\": 2739.969216487656,\n \"DC5\": 2459.864030790816\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 289,\n 278,\n 354,\n 326,\n 422,\n 522,\n 698,\n 870,\n 1024,\n 1340,\n 1480,\n 1212,\n 1212,\n 1018,\n 644,\n 538,\n 390,\n 366,\n 365,\n 316\n ],\n \"SKU_Premium\": [\n 128,\n 135,\n 152,\n 167,\n 242,\n 274,\n 396,\n 444,\n 525,\n 661,\n 637,\n 617,\n 549,\n 393,\n 301,\n 306,\n 197,\n 168,\n 168,\n 144\n ],\n \"SKU_ShortLife\": [\n 130,\n 135,\n 118,\n 152,\n 179,\n 225,\n 318,\n 375,\n 390,\n 482,\n 485,\n 492,\n 457,\n 395,\n 252,\n 197,\n 178,\n 126,\n 135,\n 127\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 100,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f6_pack_size_integer_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\": 4415.927385224888, \"DC2\": 3462.031052814994, \"DC3\": 2705.5936007124646, \"DC4\": 2739.969216487656, \"DC5\": 2459.864030790816}, \"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\": [289, 278, 354, 326, 422, 522, 698, 870, 1024, 1340, 1480, 1212, 1212, 1018, 644, 538, 390, 366, 365, 316], \"SKU_Premium\": [128, 135, 152, 167, 242, 274, 396, 444, 525, 661, 637, 617, 549, 393, 301, 306, 197, 168, 168, 144], \"SKU_ShortLife\": [130, 135, 118, 152, 179, 225, 318, 375, 390, 482, 485, 492, 457, 395, 252, 197, 178, 126, 135, 127]}, \"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\": 100, \"budget_per_period\": null, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL (TL)", "reference_objective": 401053.48} {"scenario_id": "retail_f7_budget_limit_v0", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_budget_limit_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 10000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_budget_limit_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\": 10000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 733496.92} {"scenario_id": "retail_f7_budget_limit_v1", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_budget_limit_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3998.489398258554,\n \"DC2\": 3453.3799871573237,\n \"DC3\": 3287.160779783092,\n \"DC4\": 3033.093262419767,\n \"DC5\": 2137.1187005638694\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 289,\n 308,\n 305,\n 359,\n 448,\n 484,\n 713,\n 911,\n 987,\n 1262,\n 1348,\n 1214,\n 1127,\n 867,\n 696,\n 630,\n 408,\n 393,\n 296,\n 330\n ],\n \"SKU_Premium\": [\n 148,\n 170,\n 143,\n 156,\n 199,\n 269,\n 378,\n 435,\n 489,\n 647,\n 567,\n 709,\n 539,\n 418,\n 377,\n 240,\n 188,\n 196,\n 164,\n 161\n ],\n \"SKU_ShortLife\": [\n 129,\n 120,\n 126,\n 156,\n 192,\n 250,\n 244,\n 412,\n 404,\n 429,\n 596,\n 488,\n 488,\n 414,\n 261,\n 200,\n 167,\n 165,\n 113,\n 106\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 10000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_budget_limit_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\": 3998.489398258554, \"DC2\": 3453.3799871573237, \"DC3\": 3287.160779783092, \"DC4\": 3033.093262419767, \"DC5\": 2137.1187005638694}, \"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\": [289, 308, 305, 359, 448, 484, 713, 911, 987, 1262, 1348, 1214, 1127, 867, 696, 630, 408, 393, 296, 330], \"SKU_Premium\": [148, 170, 143, 156, 199, 269, 378, 435, 489, 647, 567, 709, 539, 418, 377, 240, 188, 196, 164, 161], \"SKU_ShortLife\": [129, 120, 126, 156, 192, 250, 244, 412, 404, 429, 596, 488, 488, 414, 261, 200, 167, 165, 113, 106]}, \"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\": 10000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 718711.42} {"scenario_id": "retail_f7_budget_limit_v2", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_budget_limit_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4175.836049708792,\n \"DC2\": 3553.8666157023576,\n \"DC3\": 2615.5756092165257,\n \"DC4\": 3161.1863411372688,\n \"DC5\": 2265.9833429746027\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 326,\n 308,\n 285,\n 314,\n 405,\n 614,\n 675,\n 1036,\n 1160,\n 1150,\n 1294,\n 1123,\n 1125,\n 808,\n 637,\n 580,\n 468,\n 348,\n 290,\n 300\n ],\n \"SKU_Premium\": [\n 159,\n 165,\n 164,\n 155,\n 214,\n 295,\n 316,\n 499,\n 471,\n 577,\n 663,\n 662,\n 614,\n 426,\n 361,\n 262,\n 193,\n 163,\n 177,\n 145\n ],\n \"SKU_ShortLife\": [\n 134,\n 134,\n 124,\n 164,\n 166,\n 233,\n 294,\n 322,\n 433,\n 476,\n 520,\n 476,\n 414,\n 310,\n 282,\n 218,\n 184,\n 161,\n 126,\n 127\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 10000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_budget_limit_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\": 4175.836049708792, \"DC2\": 3553.8666157023576, \"DC3\": 2615.5756092165257, \"DC4\": 3161.1863411372688, \"DC5\": 2265.9833429746027}, \"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\": [326, 308, 285, 314, 405, 614, 675, 1036, 1160, 1150, 1294, 1123, 1125, 808, 637, 580, 468, 348, 290, 300], \"SKU_Premium\": [159, 165, 164, 155, 214, 295, 316, 499, 471, 577, 663, 662, 614, 426, 361, 262, 193, 163, 177, 145], \"SKU_ShortLife\": [134, 134, 124, 164, 166, 233, 294, 322, 433, 476, 520, 476, 414, 310, 282, 218, 184, 161, 126, 127]}, \"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\": 10000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 715371.42} {"scenario_id": "retail_f7_budget_limit_v3", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_budget_limit_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4096.4313136085675,\n \"DC2\": 3494.9845727067245,\n \"DC3\": 2753.0660744483826,\n \"DC4\": 3373.2734727450375,\n \"DC5\": 2438.639192226832\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 298,\n 304,\n 306,\n 376,\n 461,\n 512,\n 605,\n 772,\n 937,\n 1146,\n 1431,\n 1320,\n 1043,\n 797,\n 782,\n 549,\n 402,\n 317,\n 351,\n 344\n ],\n \"SKU_Premium\": [\n 137,\n 152,\n 150,\n 191,\n 209,\n 255,\n 306,\n 517,\n 563,\n 664,\n 705,\n 678,\n 499,\n 469,\n 372,\n 267,\n 219,\n 158,\n 149,\n 161\n ],\n \"SKU_ShortLife\": [\n 110,\n 111,\n 141,\n 144,\n 148,\n 247,\n 246,\n 349,\n 389,\n 476,\n 489,\n 478,\n 406,\n 360,\n 275,\n 249,\n 197,\n 155,\n 146,\n 111\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 10000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_budget_limit_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\": 4096.4313136085675, \"DC2\": 3494.9845727067245, \"DC3\": 2753.0660744483826, \"DC4\": 3373.2734727450375, \"DC5\": 2438.639192226832}, \"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\": [298, 304, 306, 376, 461, 512, 605, 772, 937, 1146, 1431, 1320, 1043, 797, 782, 549, 402, 317, 351, 344], \"SKU_Premium\": [137, 152, 150, 191, 209, 255, 306, 517, 563, 664, 705, 678, 499, 469, 372, 267, 219, 158, 149, 161], \"SKU_ShortLife\": [110, 111, 141, 144, 148, 247, 246, 349, 389, 476, 489, 478, 406, 360, 275, 249, 197, 155, 146, 111]}, \"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\": 10000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 714690.83} {"scenario_id": "retail_f7_budget_limit_v4", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_budget_limit\nScenario ID: retail_f7_budget_limit_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer faces a per-period open-to-buy budget that limits total spending on inventory-related activities across the network. This budget must cover purchasing and possibly other variable costs, coupling decisions across locations in each period. Demand is local and exogenous, and unmet demand is lost and penalized.\n\nStructure cues:\n- The underlying network is the same single-echelon structure with potential transshipment and storage capacity as in the base network for this family.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies budget_per_period=10000. For each period, the total purchasing spend (order quantity times purchasing cost) plus any fixed ordering costs if enabled must not exceed this budget.\n- Inventory balance for each product, location, and period follows the standard pattern with production or inbound shipments, outbound shipments, sales, and waste, and inventory must remain non-negative.\n- The budget constraint must be encoded so that spending above the budget is not allowed in any period.\n- The transshipment network and lead times match the base network archetype for this family.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting the period-by-period budget caps.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_budget_limit_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3970.7175350515113,\n \"DC2\": 3647.568044917981,\n \"DC3\": 2841.514692252059,\n \"DC4\": 2741.3128105278483,\n \"DC5\": 2139.3898074680574\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 320,\n 304,\n 327,\n 393,\n 477,\n 627,\n 679,\n 817,\n 973,\n 1237,\n 1468,\n 1170,\n 976,\n 940,\n 806,\n 555,\n 425,\n 362,\n 335,\n 283\n ],\n \"SKU_Premium\": [\n 166,\n 160,\n 186,\n 172,\n 218,\n 249,\n 315,\n 441,\n 537,\n 557,\n 674,\n 647,\n 517,\n 427,\n 395,\n 252,\n 217,\n 183,\n 158,\n 148\n ],\n \"SKU_ShortLife\": [\n 109,\n 106,\n 131,\n 125,\n 148,\n 230,\n 324,\n 312,\n 447,\n 484,\n 583,\n 451,\n 440,\n 371,\n 310,\n 187,\n 166,\n 153,\n 135,\n 129\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": 10000.0,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_budget_limit_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\": 3970.7175350515113, \"DC2\": 3647.568044917981, \"DC3\": 2841.514692252059, \"DC4\": 2741.3128105278483, \"DC5\": 2139.3898074680574}, \"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\": [320, 304, 327, 393, 477, 627, 679, 817, 973, 1237, 1468, 1170, 976, 940, 806, 555, 425, 362, 335, 283], \"SKU_Premium\": [166, 160, 186, 172, 218, 249, 315, 441, 537, 557, 674, 647, 517, 427, 395, 252, 217, 183, 158, 148], \"SKU_ShortLife\": [109, 106, 131, 125, 148, 230, 324, 312, 447, 484, 583, 451, 440, 371, 310, 187, 166, 153, 135, 129]}, \"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\": 10000.0, \"waste_limit_pct\": null}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 719933.0} {"scenario_id": "retail_f7_hub_and_spoke_v0", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_hub_and_spoke_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 50000.0,\n \"DC2\": 500.0,\n \"DC3\": 500.0,\n \"DC4\": 500.0,\n \"DC5\": 500.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_hub_and_spoke_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\": 50000.0, \"DC2\": 500.0, \"DC3\": 500.0, \"DC4\": 500.0, \"DC5\": 500.0}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 444921.89} {"scenario_id": "retail_f7_hub_and_spoke_v1", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_hub_and_spoke_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 47296.863376300804,\n \"DC2\": 503.1124425797423,\n \"DC3\": 564.106199291641,\n \"DC4\": 428.507161631731,\n \"DC5\": 460.5290648050913\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 321,\n 276,\n 351,\n 340,\n 407,\n 525,\n 783,\n 836,\n 1198,\n 1228,\n 1144,\n 1261,\n 1263,\n 827,\n 722,\n 590,\n 494,\n 329,\n 304,\n 277\n ],\n \"SKU_Premium\": [\n 167,\n 177,\n 186,\n 161,\n 235,\n 285,\n 359,\n 424,\n 490,\n 542,\n 666,\n 665,\n 620,\n 417,\n 407,\n 269,\n 211,\n 173,\n 169,\n 151\n ],\n \"SKU_ShortLife\": [\n 136,\n 136,\n 146,\n 152,\n 197,\n 207,\n 287,\n 349,\n 459,\n 497,\n 548,\n 472,\n 406,\n 314,\n 280,\n 186,\n 180,\n 164,\n 147,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_hub_and_spoke_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\": 47296.863376300804, \"DC2\": 503.1124425797423, \"DC3\": 564.106199291641, \"DC4\": 428.507161631731, \"DC5\": 460.5290648050913}, \"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\": [321, 276, 351, 340, 407, 525, 783, 836, 1198, 1228, 1144, 1261, 1263, 827, 722, 590, 494, 329, 304, 277], \"SKU_Premium\": [167, 177, 186, 161, 235, 285, 359, 424, 490, 542, 666, 665, 620, 417, 407, 269, 211, 173, 169, 151], \"SKU_ShortLife\": [136, 136, 146, 152, 197, 207, 287, 349, 459, 497, 548, 472, 406, 314, 280, 186, 180, 164, 147, 119]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 448347.29} {"scenario_id": "retail_f7_hub_and_spoke_v2", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_hub_and_spoke_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 45269.52633700389,\n \"DC2\": 428.1617719325459,\n \"DC3\": 523.2689252932706,\n \"DC4\": 545.7082348928822,\n \"DC5\": 570.4733724016971\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 332,\n 274,\n 369,\n 413,\n 383,\n 488,\n 710,\n 775,\n 1119,\n 1256,\n 1154,\n 1317,\n 1045,\n 796,\n 675,\n 522,\n 492,\n 402,\n 283,\n 318\n ],\n \"SKU_Premium\": [\n 141,\n 163,\n 179,\n 194,\n 190,\n 265,\n 321,\n 410,\n 570,\n 603,\n 634,\n 617,\n 486,\n 506,\n 347,\n 303,\n 226,\n 176,\n 186,\n 158\n ],\n \"SKU_ShortLife\": [\n 125,\n 133,\n 111,\n 165,\n 198,\n 228,\n 307,\n 360,\n 433,\n 475,\n 490,\n 556,\n 497,\n 397,\n 288,\n 220,\n 184,\n 149,\n 119,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_hub_and_spoke_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\": 45269.52633700389, \"DC2\": 428.1617719325459, \"DC3\": 523.2689252932706, \"DC4\": 545.7082348928822, \"DC5\": 570.4733724016971}, \"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\": [332, 274, 369, 413, 383, 488, 710, 775, 1119, 1256, 1154, 1317, 1045, 796, 675, 522, 492, 402, 283, 318], \"SKU_Premium\": [141, 163, 179, 194, 190, 265, 321, 410, 570, 603, 634, 617, 486, 506, 347, 303, 226, 176, 186, 158], \"SKU_ShortLife\": [125, 133, 111, 165, 198, 228, 307, 360, 433, 475, 490, 556, 497, 397, 288, 220, 184, 149, 119, 116]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 430416.21} {"scenario_id": "retail_f7_hub_and_spoke_v3", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_hub_and_spoke_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 42642.230286051425,\n \"DC2\": 454.13805783824085,\n \"DC3\": 558.6350115274392,\n \"DC4\": 544.3985903240658,\n \"DC5\": 467.75168054568974\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 315,\n 325,\n 294,\n 377,\n 492,\n 573,\n 661,\n 796,\n 962,\n 1364,\n 1371,\n 1100,\n 973,\n 1034,\n 700,\n 607,\n 411,\n 379,\n 351,\n 284\n ],\n \"SKU_Premium\": [\n 154,\n 154,\n 173,\n 202,\n 238,\n 235,\n 352,\n 438,\n 621,\n 700,\n 611,\n 583,\n 558,\n 426,\n 334,\n 279,\n 220,\n 188,\n 155,\n 151\n ],\n \"SKU_ShortLife\": [\n 124,\n 131,\n 129,\n 144,\n 159,\n 189,\n 256,\n 395,\n 490,\n 475,\n 570,\n 461,\n 449,\n 372,\n 305,\n 213,\n 178,\n 154,\n 120,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_hub_and_spoke_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\": 42642.230286051425, \"DC2\": 454.13805783824085, \"DC3\": 558.6350115274392, \"DC4\": 544.3985903240658, \"DC5\": 467.75168054568974}, \"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\": [315, 325, 294, 377, 492, 573, 661, 796, 962, 1364, 1371, 1100, 973, 1034, 700, 607, 411, 379, 351, 284], \"SKU_Premium\": [154, 154, 173, 202, 238, 235, 352, 438, 621, 700, 611, 583, 558, 426, 334, 279, 220, 188, 155, 151], \"SKU_ShortLife\": [124, 131, 129, 144, 159, 189, 256, 395, 490, 475, 570, 461, 449, 372, 305, 213, 178, 154, 120, 116]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 441399.64} {"scenario_id": "retail_f7_hub_and_spoke_v4", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_hub_and_spoke\nScenario ID: retail_f7_hub_and_spoke_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network has one high-capacity hub distribution center that ships to several low-capacity spokes. All lateral movements must pass through the hub; spokes cannot ship directly to each other or back to the hub. Demand occurs at spokes and is local. This captures a hub-and-spoke distribution strategy where stock is pooled at the hub and then pushed out to stores.\n\nStructure cues:\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. DC1 (hub) has capacity 50000, while other locations (spokes) have capacity 500 each.\n- The transshipment network consists only of directed edges from DC1 (hub) to each spoke [DC2, DC3, DC4, DC5]. Inventory can move from the hub to the spokes but not directly between spokes and not from spokes back to the hub.\n- For each product, location, and period, inventory evolves based on local production (if any), inbound shipments, outbound shipments, sales (at spokes), and waste, and must remain non-negative.\n- Transshipment flows from the hub are limited by the hub's available inventory and incur transshipment costs. Spokes largely rely on inbound shipments from the hub to meet local demand.\n- Lead times for transshipment are effectively zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while exploiting the centralized hub structure.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_hub_and_spoke_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 46467.68884742709,\n \"DC2\": 550.5163222763139,\n \"DC3\": 443.00288688502576,\n \"DC4\": 466.51837219891223,\n \"DC5\": 565.8551681039663\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 323,\n 342,\n 301,\n 319,\n 471,\n 573,\n 767,\n 1004,\n 1252,\n 1195,\n 1414,\n 1083,\n 1159,\n 965,\n 797,\n 530,\n 425,\n 370,\n 298,\n 352\n ],\n \"SKU_Premium\": [\n 130,\n 177,\n 164,\n 184,\n 194,\n 282,\n 373,\n 425,\n 546,\n 706,\n 597,\n 657,\n 539,\n 446,\n 329,\n 277,\n 223,\n 199,\n 173,\n 169\n ],\n \"SKU_ShortLife\": [\n 118,\n 134,\n 143,\n 147,\n 182,\n 204,\n 268,\n 383,\n 485,\n 467,\n 547,\n 536,\n 462,\n 402,\n 317,\n 186,\n 189,\n 147,\n 136,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_hub_and_spoke_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\": 46467.68884742709, \"DC2\": 550.5163222763139, \"DC3\": 443.00288688502576, \"DC4\": 466.51837219891223, \"DC5\": 565.8551681039663}, \"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\": [323, 342, 301, 319, 471, 573, 767, 1004, 1252, 1195, 1414, 1083, 1159, 965, 797, 530, 425, 370, 298, 352], \"SKU_Premium\": [130, 177, 164, 184, 194, 282, 373, 425, 546, 706, 597, 657, 539, 446, 329, 277, 223, 199, 173, 169], \"SKU_ShortLife\": [118, 134, 143, 147, 182, 204, 268, 383, 485, 467, 547, 536, 462, 402, 317, 186, 189, 147, 136, 130]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 462895.92} {"scenario_id": "retail_f7_multi_sourcing_v0", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multi_sourcing_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 5,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 1\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 10.0,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multi_sourcing_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\": 5, \"SKU_Premium\": 0, \"SKU_ShortLife\": 1}, \"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\": 0.5, \"SKU_Premium\": 10.0, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 524480.5} {"scenario_id": "retail_f7_multi_sourcing_v1", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multi_sourcing_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 5,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 1\n },\n \"cold_capacity\": {\n \"DC1\": 3456.3645401623567,\n \"DC2\": 3544.86702667332,\n \"DC3\": 3008.8219270638024,\n \"DC4\": 2687.2716663554443,\n \"DC5\": 2235.463908876728\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 321,\n 273,\n 375,\n 355,\n 421,\n 470,\n 763,\n 887,\n 1015,\n 1291,\n 1203,\n 1122,\n 1022,\n 917,\n 754,\n 515,\n 454,\n 333,\n 375,\n 322\n ],\n \"SKU_Premium\": [\n 170,\n 133,\n 179,\n 178,\n 237,\n 303,\n 308,\n 396,\n 631,\n 697,\n 656,\n 678,\n 619,\n 439,\n 325,\n 251,\n 191,\n 168,\n 150,\n 164\n ],\n \"SKU_ShortLife\": [\n 136,\n 127,\n 116,\n 136,\n 168,\n 202,\n 270,\n 322,\n 486,\n 537,\n 555,\n 439,\n 414,\n 379,\n 254,\n 220,\n 171,\n 136,\n 134,\n 130\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 10.0,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multi_sourcing_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\": 5, \"SKU_Premium\": 0, \"SKU_ShortLife\": 1}, \"cold_capacity\": {\"DC1\": 3456.3645401623567, \"DC2\": 3544.86702667332, \"DC3\": 3008.8219270638024, \"DC4\": 2687.2716663554443, \"DC5\": 2235.463908876728}, \"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\": [321, 273, 375, 355, 421, 470, 763, 887, 1015, 1291, 1203, 1122, 1022, 917, 754, 515, 454, 333, 375, 322], \"SKU_Premium\": [170, 133, 179, 178, 237, 303, 308, 396, 631, 697, 656, 678, 619, 439, 325, 251, 191, 168, 150, 164], \"SKU_ShortLife\": [136, 127, 116, 136, 168, 202, 270, 322, 486, 537, 555, 439, 414, 379, 254, 220, 171, 136, 134, 130]}, \"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\": 0.5, \"SKU_Premium\": 10.0, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 522186.0} {"scenario_id": "retail_f7_multi_sourcing_v2", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multi_sourcing_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 5,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 1\n },\n \"cold_capacity\": {\n \"DC1\": 4084.612978823098,\n \"DC2\": 3598.26441328805,\n \"DC3\": 2650.0534022829756,\n \"DC4\": 2992.8419953849925,\n \"DC5\": 2734.206362421372\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 281,\n 314,\n 323,\n 313,\n 370,\n 569,\n 801,\n 875,\n 1010,\n 1359,\n 1275,\n 1091,\n 1248,\n 877,\n 642,\n 585,\n 465,\n 406,\n 323,\n 267\n ],\n \"SKU_Premium\": [\n 165,\n 161,\n 142,\n 196,\n 211,\n 242,\n 379,\n 467,\n 604,\n 626,\n 614,\n 576,\n 516,\n 403,\n 306,\n 273,\n 194,\n 159,\n 145,\n 149\n ],\n \"SKU_ShortLife\": [\n 128,\n 127,\n 145,\n 158,\n 179,\n 224,\n 270,\n 325,\n 480,\n 486,\n 465,\n 509,\n 437,\n 351,\n 264,\n 209,\n 160,\n 158,\n 122,\n 140\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 10.0,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multi_sourcing_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\": 5, \"SKU_Premium\": 0, \"SKU_ShortLife\": 1}, \"cold_capacity\": {\"DC1\": 4084.612978823098, \"DC2\": 3598.26441328805, \"DC3\": 2650.0534022829756, \"DC4\": 2992.8419953849925, \"DC5\": 2734.206362421372}, \"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\": [281, 314, 323, 313, 370, 569, 801, 875, 1010, 1359, 1275, 1091, 1248, 877, 642, 585, 465, 406, 323, 267], \"SKU_Premium\": [165, 161, 142, 196, 211, 242, 379, 467, 604, 626, 614, 576, 516, 403, 306, 273, 194, 159, 145, 149], \"SKU_ShortLife\": [128, 127, 145, 158, 179, 224, 270, 325, 480, 486, 465, 509, 437, 351, 264, 209, 160, 158, 122, 140]}, \"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\": 0.5, \"SKU_Premium\": 10.0, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 508672.0} {"scenario_id": "retail_f7_multi_sourcing_v3", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multi_sourcing_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 5,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 1\n },\n \"cold_capacity\": {\n \"DC1\": 4304.482184332716,\n \"DC2\": 3109.200946582979,\n \"DC3\": 3335.4317720467943,\n \"DC4\": 3286.9384117229283,\n \"DC5\": 2654.3116262976264\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 280,\n 316,\n 361,\n 345,\n 376,\n 602,\n 681,\n 881,\n 1135,\n 1078,\n 1398,\n 1122,\n 966,\n 935,\n 777,\n 548,\n 428,\n 361,\n 291,\n 350\n ],\n \"SKU_Premium\": [\n 142,\n 138,\n 145,\n 205,\n 186,\n 240,\n 370,\n 462,\n 472,\n 660,\n 701,\n 654,\n 502,\n 458,\n 383,\n 294,\n 204,\n 192,\n 158,\n 162\n ],\n \"SKU_ShortLife\": [\n 129,\n 108,\n 112,\n 164,\n 193,\n 187,\n 251,\n 398,\n 467,\n 542,\n 464,\n 467,\n 416,\n 369,\n 295,\n 247,\n 195,\n 159,\n 127,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 10.0,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multi_sourcing_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\": 5, \"SKU_Premium\": 0, \"SKU_ShortLife\": 1}, \"cold_capacity\": {\"DC1\": 4304.482184332716, \"DC2\": 3109.200946582979, \"DC3\": 3335.4317720467943, \"DC4\": 3286.9384117229283, \"DC5\": 2654.3116262976264}, \"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\": [280, 316, 361, 345, 376, 602, 681, 881, 1135, 1078, 1398, 1122, 966, 935, 777, 548, 428, 361, 291, 350], \"SKU_Premium\": [142, 138, 145, 205, 186, 240, 370, 462, 472, 660, 701, 654, 502, 458, 383, 294, 204, 192, 158, 162], \"SKU_ShortLife\": [129, 108, 112, 164, 193, 187, 251, 398, 467, 542, 464, 467, 416, 369, 295, 247, 195, 159, 127, 116]}, \"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\": 0.5, \"SKU_Premium\": 10.0, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 507135.5} {"scenario_id": "retail_f7_multi_sourcing_v4", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multi_sourcing\nScenario ID: retail_f7_multi_sourcing_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nProducts differ in their effective sourcing regimes: some behave like slow but cheap supply, while others behave like fast but expensive supply. Lead times and holding costs vary across products, creating multi-speed inventory dynamics. Demand is local and exogenous at each location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with product-specific lead times, similar to retail_f6_lead_time, together with storage capacity and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON sets different lead times (SKU_Basic=5, SKU_Premium=0, SKU_ShortLife=1) and holding costs (SKU_Basic=0.5, SKU_Premium=10.0). Orders for each product become available only after that product's lead time, and inventory carried over incurs its corresponding holding cost.\n- For each product, location, and period, on-hand stock is determined by previous on-hand stock, arrivals of past orders whose lead time completes in that period, sales, and waste, and must remain non-negative.\n- The scenario mimics slow/cheap (Basic) and fast/expensive (Premium) sourcing channels at the product level through heterogeneous lead times and cost profiles.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while correctly handling the different lead times and holding-cost profiles.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multi_sourcing_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 5,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 1\n },\n \"cold_capacity\": {\n \"DC1\": 3819.1237104651036,\n \"DC2\": 3224.2858454662423,\n \"DC3\": 3083.3458495977297,\n \"DC4\": 2954.237590018825,\n \"DC5\": 2566.460979143829\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 262,\n 355,\n 353,\n 348,\n 499,\n 630,\n 689,\n 903,\n 1184,\n 1341,\n 1385,\n 1352,\n 1022,\n 793,\n 793,\n 511,\n 393,\n 329,\n 305,\n 339\n ],\n \"SKU_Premium\": [\n 149,\n 146,\n 160,\n 171,\n 209,\n 273,\n 367,\n 447,\n 470,\n 581,\n 599,\n 713,\n 580,\n 432,\n 406,\n 234,\n 196,\n 203,\n 172,\n 149\n ],\n \"SKU_ShortLife\": [\n 111,\n 136,\n 146,\n 142,\n 168,\n 194,\n 263,\n 329,\n 405,\n 489,\n 487,\n 509,\n 418,\n 324,\n 284,\n 188,\n 187,\n 143,\n 124,\n 105\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 10.0,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multi_sourcing_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\": 5, \"SKU_Premium\": 0, \"SKU_ShortLife\": 1}, \"cold_capacity\": {\"DC1\": 3819.1237104651036, \"DC2\": 3224.2858454662423, \"DC3\": 3083.3458495977297, \"DC4\": 2954.237590018825, \"DC5\": 2566.460979143829}, \"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, 355, 353, 348, 499, 630, 689, 903, 1184, 1341, 1385, 1352, 1022, 793, 793, 511, 393, 329, 305, 339], \"SKU_Premium\": [149, 146, 160, 171, 209, 273, 367, 447, 470, 581, 599, 713, 580, 432, 406, 234, 196, 203, 172, 149], \"SKU_ShortLife\": [111, 136, 146, 142, 168, 194, 263, 329, 405, 489, 487, 509, 418, 324, 284, 188, 187, 143, 124, 105]}, \"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\": 0.5, \"SKU_Premium\": 10.0, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 529493.0} {"scenario_id": "retail_f7_multiechelon_chain_v0", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multiechelon_chain_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"Plant\",\n \"DC1\",\n \"DC2\",\n \"Store1\",\n \"Store2\",\n \"Store3\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"Plant\": 8000.0,\n \"DC1\": 4000.0,\n \"DC2\": 4000.0,\n \"Store1\": 600.0,\n \"Store2\": 600.0,\n \"Store3\": 600.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"Plant\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"Store1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"Plant\": 0.0,\n \"DC1\": 0.0,\n \"DC2\": 0.0,\n \"Store1\": 0.3,\n \"Store2\": 0.4,\n \"Store3\": 0.3\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"Plant\",\n \"DC1\"\n ],\n [\n \"Plant\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"Store1\"\n ],\n [\n \"DC1\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store3\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multiechelon_chain_v0\", \"description\": \"Standard seasonal retail scenario.\", \"periods\": 20, \"products\": [\"SKU_Basic\", \"SKU_Premium\", \"SKU_ShortLife\"], \"locations\": [\"Plant\", \"DC1\", \"DC2\", \"Store1\", \"Store2\", \"Store3\"], \"shelf_life\": {\"SKU_Basic\": 10, \"SKU_Premium\": 8, \"SKU_ShortLife\": 4}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"Plant\": 8000.0, \"DC1\": 4000.0, \"DC2\": 4000.0, \"Store1\": 600.0, \"Store2\": 600.0, \"Store3\": 600.0}, \"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\": {\"Plant\": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], \"DC1\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"Store1\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.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\": {\"Plant\": 0.0, \"DC1\": 0.0, \"DC2\": 0.0, \"Store1\": 0.3, \"Store2\": 0.4, \"Store3\": 0.3}, \"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\": [[\"Plant\", \"DC1\"], [\"Plant\", \"DC2\"], [\"DC1\", \"Store1\"], [\"DC1\", \"Store2\"], [\"DC2\", \"Store2\"], [\"DC2\", \"Store3\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 622677.8} {"scenario_id": "retail_f7_multiechelon_chain_v1", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multiechelon_chain_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"Plant\",\n \"DC1\",\n \"DC2\",\n \"Store1\",\n \"Store2\",\n \"Store3\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"Plant\": 7969.798541468495,\n \"DC1\": 3407.868633501556,\n \"DC2\": 4226.874768906733,\n \"Store1\": 527.5535465562568,\n \"Store2\": 574.4081112573077,\n \"Store3\": 591.0778823689047\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"Plant\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"Store1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 341,\n 355,\n 365,\n 414,\n 422,\n 514,\n 633,\n 882,\n 1170,\n 1149,\n 1129,\n 1118,\n 1120,\n 975,\n 802,\n 621,\n 496,\n 314,\n 295,\n 275\n ],\n \"SKU_Premium\": [\n 163,\n 172,\n 184,\n 165,\n 243,\n 256,\n 304,\n 486,\n 617,\n 714,\n 602,\n 627,\n 529,\n 513,\n 334,\n 293,\n 224,\n 175,\n 153,\n 141\n ],\n \"SKU_ShortLife\": [\n 122,\n 129,\n 126,\n 144,\n 168,\n 211,\n 313,\n 327,\n 377,\n 469,\n 574,\n 467,\n 470,\n 415,\n 265,\n 221,\n 194,\n 139,\n 126,\n 116\n ]\n },\n \"demand_share\": {\n \"Plant\": 0.0,\n \"DC1\": 0.0,\n \"DC2\": 0.0,\n \"Store1\": 0.3,\n \"Store2\": 0.4,\n \"Store3\": 0.3\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"Plant\",\n \"DC1\"\n ],\n [\n \"Plant\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"Store1\"\n ],\n [\n \"DC1\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store3\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multiechelon_chain_v1\", \"description\": \"Standard seasonal retail scenario.\", \"periods\": 20, \"products\": [\"SKU_Basic\", \"SKU_Premium\", \"SKU_ShortLife\"], \"locations\": [\"Plant\", \"DC1\", \"DC2\", \"Store1\", \"Store2\", \"Store3\"], \"shelf_life\": {\"SKU_Basic\": 10, \"SKU_Premium\": 8, \"SKU_ShortLife\": 4}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"Plant\": 7969.798541468495, \"DC1\": 3407.868633501556, \"DC2\": 4226.874768906733, \"Store1\": 527.5535465562568, \"Store2\": 574.4081112573077, \"Store3\": 591.0778823689047}, \"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\": {\"Plant\": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], \"DC1\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"Store1\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.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\": [341, 355, 365, 414, 422, 514, 633, 882, 1170, 1149, 1129, 1118, 1120, 975, 802, 621, 496, 314, 295, 275], \"SKU_Premium\": [163, 172, 184, 165, 243, 256, 304, 486, 617, 714, 602, 627, 529, 513, 334, 293, 224, 175, 153, 141], \"SKU_ShortLife\": [122, 129, 126, 144, 168, 211, 313, 327, 377, 469, 574, 467, 470, 415, 265, 221, 194, 139, 126, 116]}, \"demand_share\": {\"Plant\": 0.0, \"DC1\": 0.0, \"DC2\": 0.0, \"Store1\": 0.3, \"Store2\": 0.4, \"Store3\": 0.3}, \"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\": [[\"Plant\", \"DC1\"], [\"Plant\", \"DC2\"], [\"DC1\", \"Store1\"], [\"DC1\", \"Store2\"], [\"DC2\", \"Store2\"], [\"DC2\", \"Store3\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 641471.79} {"scenario_id": "retail_f7_multiechelon_chain_v2", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multiechelon_chain_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"Plant\",\n \"DC1\",\n \"DC2\",\n \"Store1\",\n \"Store2\",\n \"Store3\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"Plant\": 8174.125923331587,\n \"DC1\": 3474.8210135904546,\n \"DC2\": 4131.976792991967,\n \"Store1\": 570.6196903715588,\n \"Store2\": 543.3681657022936,\n \"Store3\": 523.7522710232104\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"Plant\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"Store1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 302,\n 371,\n 329,\n 439,\n 515,\n 651,\n 836,\n 1242,\n 1389,\n 1396,\n 1405,\n 1144,\n 1021,\n 763,\n 586,\n 378,\n 371,\n 332,\n 335\n ],\n \"SKU_Premium\": [\n 170,\n 168,\n 181,\n 185,\n 231,\n 258,\n 337,\n 480,\n 554,\n 715,\n 706,\n 592,\n 620,\n 511,\n 397,\n 289,\n 218,\n 185,\n 172,\n 171\n ],\n \"SKU_ShortLife\": [\n 119,\n 136,\n 116,\n 126,\n 152,\n 214,\n 310,\n 340,\n 482,\n 523,\n 594,\n 517,\n 376,\n 356,\n 244,\n 206,\n 178,\n 165,\n 120,\n 142\n ]\n },\n \"demand_share\": {\n \"Plant\": 0.0,\n \"DC1\": 0.0,\n \"DC2\": 0.0,\n \"Store1\": 0.3,\n \"Store2\": 0.4,\n \"Store3\": 0.3\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"Plant\",\n \"DC1\"\n ],\n [\n \"Plant\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"Store1\"\n ],\n [\n \"DC1\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store3\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multiechelon_chain_v2\", \"description\": \"Standard seasonal retail scenario.\", \"periods\": 20, \"products\": [\"SKU_Basic\", \"SKU_Premium\", \"SKU_ShortLife\"], \"locations\": [\"Plant\", \"DC1\", \"DC2\", \"Store1\", \"Store2\", \"Store3\"], \"shelf_life\": {\"SKU_Basic\": 10, \"SKU_Premium\": 8, \"SKU_ShortLife\": 4}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"Plant\": 8174.125923331587, \"DC1\": 3474.8210135904546, \"DC2\": 4131.976792991967, \"Store1\": 570.6196903715588, \"Store2\": 543.3681657022936, \"Store3\": 523.7522710232104}, \"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\": {\"Plant\": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], \"DC1\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"Store1\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.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, 302, 371, 329, 439, 515, 651, 836, 1242, 1389, 1396, 1405, 1144, 1021, 763, 586, 378, 371, 332, 335], \"SKU_Premium\": [170, 168, 181, 185, 231, 258, 337, 480, 554, 715, 706, 592, 620, 511, 397, 289, 218, 185, 172, 171], \"SKU_ShortLife\": [119, 136, 116, 126, 152, 214, 310, 340, 482, 523, 594, 517, 376, 356, 244, 206, 178, 165, 120, 142]}, \"demand_share\": {\"Plant\": 0.0, \"DC1\": 0.0, \"DC2\": 0.0, \"Store1\": 0.3, \"Store2\": 0.4, \"Store3\": 0.3}, \"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\": [[\"Plant\", \"DC1\"], [\"Plant\", \"DC2\"], [\"DC1\", \"Store1\"], [\"DC1\", \"Store2\"], [\"DC2\", \"Store2\"], [\"DC2\", \"Store3\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 712822.05} {"scenario_id": "retail_f7_multiechelon_chain_v3", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multiechelon_chain_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"Plant\",\n \"DC1\",\n \"DC2\",\n \"Store1\",\n \"Store2\",\n \"Store3\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"Plant\": 7636.056212789862,\n \"DC1\": 4575.052368264268,\n \"DC2\": 3856.8306184928415,\n \"Store1\": 576.5948896306264,\n \"Store2\": 521.8922423791751,\n \"Store3\": 679.0933700497394\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"Plant\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"Store1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 260,\n 304,\n 333,\n 398,\n 499,\n 615,\n 680,\n 1027,\n 1206,\n 1175,\n 1418,\n 1414,\n 1134,\n 840,\n 703,\n 484,\n 430,\n 372,\n 325,\n 312\n ],\n \"SKU_Premium\": [\n 156,\n 162,\n 186,\n 191,\n 225,\n 268,\n 343,\n 409,\n 524,\n 620,\n 660,\n 646,\n 518,\n 511,\n 355,\n 265,\n 214,\n 174,\n 144,\n 163\n ],\n \"SKU_ShortLife\": [\n 104,\n 127,\n 119,\n 158,\n 170,\n 231,\n 245,\n 384,\n 380,\n 428,\n 490,\n 447,\n 397,\n 413,\n 248,\n 195,\n 185,\n 142,\n 130,\n 108\n ]\n },\n \"demand_share\": {\n \"Plant\": 0.0,\n \"DC1\": 0.0,\n \"DC2\": 0.0,\n \"Store1\": 0.3,\n \"Store2\": 0.4,\n \"Store3\": 0.3\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"Plant\",\n \"DC1\"\n ],\n [\n \"Plant\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"Store1\"\n ],\n [\n \"DC1\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store3\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multiechelon_chain_v3\", \"description\": \"Standard seasonal retail scenario.\", \"periods\": 20, \"products\": [\"SKU_Basic\", \"SKU_Premium\", \"SKU_ShortLife\"], \"locations\": [\"Plant\", \"DC1\", \"DC2\", \"Store1\", \"Store2\", \"Store3\"], \"shelf_life\": {\"SKU_Basic\": 10, \"SKU_Premium\": 8, \"SKU_ShortLife\": 4}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"Plant\": 7636.056212789862, \"DC1\": 4575.052368264268, \"DC2\": 3856.8306184928415, \"Store1\": 576.5948896306264, \"Store2\": 521.8922423791751, \"Store3\": 679.0933700497394}, \"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\": {\"Plant\": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], \"DC1\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"Store1\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.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\": [260, 304, 333, 398, 499, 615, 680, 1027, 1206, 1175, 1418, 1414, 1134, 840, 703, 484, 430, 372, 325, 312], \"SKU_Premium\": [156, 162, 186, 191, 225, 268, 343, 409, 524, 620, 660, 646, 518, 511, 355, 265, 214, 174, 144, 163], \"SKU_ShortLife\": [104, 127, 119, 158, 170, 231, 245, 384, 380, 428, 490, 447, 397, 413, 248, 195, 185, 142, 130, 108]}, \"demand_share\": {\"Plant\": 0.0, \"DC1\": 0.0, \"DC2\": 0.0, \"Store1\": 0.3, \"Store2\": 0.4, \"Store3\": 0.3}, \"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\": [[\"Plant\", \"DC1\"], [\"Plant\", \"DC2\"], [\"DC1\", \"Store1\"], [\"DC1\", \"Store2\"], [\"DC2\", \"Store2\"], [\"DC2\", \"Store3\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 638919.04} {"scenario_id": "retail_f7_multiechelon_chain_v4", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_multiechelon_chain\nScenario ID: retail_f7_multiechelon_chain_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe network is an explicit three-echelon chain consisting of a plant, distribution centers, and retail stores. Demand occurs only at stores; the plant and distribution centers act purely as upstream nodes that hold and move inventory. Customers are never backordered: store demand that cannot be met from store inventory is lost and penalized.\n\nStructure cues:\n- Locations: Plant (upstream), DC1/DC2 (distribution centers), Store1/Store2/Store3 (retail). The transshipment network defines directed edges: Plant->DC1, Plant->DC2, DC1->Store1, DC1->Store2, DC2->Store2, DC2->Store3.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities differ by echelon: Plant=8000, DC1/DC2=4000, Stores=600.\n- Inventory is allowed to flow only along the directed edges. There is no direct shipment between stores, between distribution centers, or from stores back upstream.\n- Demand occurs only at store nodes according to demand_share (Store1=30%, Store2=40%, Store3=30%). Upstream nodes (Plant, DCs) do not face direct customer demand.\n- For each product, location, and period, inventory reflects previous stock, production or inbound shipments, outbound shipments, sales at stores, and waste, and must remain non-negative.\n- Lost sales occur only at store nodes when local demand cannot be served from available inventory, even after receiving shipments from upstream.\n- The objective is to minimize total cost including purchasing, holding at all echelons, transshipment, waste, and lost sales, subject to the three-echelon topology.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_multiechelon_chain_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"Plant\",\n \"DC1\",\n \"DC2\",\n \"Store1\",\n \"Store2\",\n \"Store3\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"Plant\": 7464.857246572141,\n \"DC1\": 4184.413862370035,\n \"DC2\": 4402.082575285726,\n \"Store1\": 635.488987491309,\n \"Store2\": 562.2161541552067,\n \"Store3\": 650.9184303035677\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"Plant\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"Store1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"Store3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 291,\n 338,\n 332,\n 334,\n 496,\n 481,\n 769,\n 823,\n 1246,\n 1379,\n 1182,\n 1070,\n 1136,\n 1014,\n 642,\n 472,\n 382,\n 366,\n 309,\n 279\n ],\n \"SKU_Premium\": [\n 131,\n 173,\n 173,\n 186,\n 193,\n 253,\n 392,\n 501,\n 550,\n 686,\n 691,\n 639,\n 575,\n 400,\n 324,\n 247,\n 214,\n 180,\n 158,\n 169\n ],\n \"SKU_ShortLife\": [\n 137,\n 141,\n 139,\n 129,\n 163,\n 204,\n 276,\n 334,\n 394,\n 521,\n 527,\n 494,\n 504,\n 361,\n 264,\n 197,\n 156,\n 152,\n 117,\n 116\n ]\n },\n \"demand_share\": {\n \"Plant\": 0.0,\n \"DC1\": 0.0,\n \"DC2\": 0.0,\n \"Store1\": 0.3,\n \"Store2\": 0.4,\n \"Store3\": 0.3\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"Plant\",\n \"DC1\"\n ],\n [\n \"Plant\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"Store1\"\n ],\n [\n \"DC1\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store2\"\n ],\n [\n \"DC2\",\n \"Store3\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_multiechelon_chain_v4\", \"description\": \"Standard seasonal retail scenario.\", \"periods\": 20, \"products\": [\"SKU_Basic\", \"SKU_Premium\", \"SKU_ShortLife\"], \"locations\": [\"Plant\", \"DC1\", \"DC2\", \"Store1\", \"Store2\", \"Store3\"], \"shelf_life\": {\"SKU_Basic\": 10, \"SKU_Premium\": 8, \"SKU_ShortLife\": 4}, \"lead_time\": {\"SKU_Basic\": 0, \"SKU_Premium\": 0, \"SKU_ShortLife\": 0}, \"cold_capacity\": {\"Plant\": 7464.857246572141, \"DC1\": 4184.413862370035, \"DC2\": 4402.082575285726, \"Store1\": 635.488987491309, \"Store2\": 562.2161541552067, \"Store3\": 650.9184303035677}, \"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\": {\"Plant\": [99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0, 99999.0], \"DC1\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"Store1\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"Store3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.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\": [291, 338, 332, 334, 496, 481, 769, 823, 1246, 1379, 1182, 1070, 1136, 1014, 642, 472, 382, 366, 309, 279], \"SKU_Premium\": [131, 173, 173, 186, 193, 253, 392, 501, 550, 686, 691, 639, 575, 400, 324, 247, 214, 180, 158, 169], \"SKU_ShortLife\": [137, 141, 139, 129, 163, 204, 276, 334, 394, 521, 527, 494, 504, 361, 264, 197, 156, 152, 117, 116]}, \"demand_share\": {\"Plant\": 0.0, \"DC1\": 0.0, \"DC2\": 0.0, \"Store1\": 0.3, \"Store2\": 0.4, \"Store3\": 0.3}, \"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\": [[\"Plant\", \"DC1\"], [\"Plant\", \"DC2\"], [\"DC1\", \"Store1\"], [\"DC1\", \"Store2\"], [\"DC2\", \"Store2\"], [\"DC2\", \"Store3\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 624743.26} {"scenario_id": "retail_f7_ring_routing_v0", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_ring_routing_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3200.0,\n \"DC2\": 2800.0,\n \"DC3\": 2400.0,\n \"DC4\": 2400.0,\n \"DC5\": 2000.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_ring_routing_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\": 3200.0, \"DC2\": 2800.0, \"DC3\": 2400.0, \"DC4\": 2400.0, \"DC5\": 2000.0}, \"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\": [[\"DC1\", \"DC2\"], [\"DC2\", \"DC3\"], [\"DC3\", \"DC4\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f7_ring_routing_v1", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_ring_routing_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2991.8326868227214,\n \"DC2\": 2532.9007952808656,\n \"DC3\": 2608.4258534753153,\n \"DC4\": 2118.6262010983583,\n \"DC5\": 2207.6219002477706\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 342,\n 293,\n 376,\n 397,\n 429,\n 588,\n 811,\n 952,\n 1238,\n 1392,\n 1210,\n 1308,\n 1038,\n 1007,\n 614,\n 540,\n 496,\n 335,\n 330,\n 270\n ],\n \"SKU_Premium\": [\n 135,\n 140,\n 159,\n 203,\n 203,\n 238,\n 356,\n 489,\n 624,\n 593,\n 583,\n 576,\n 608,\n 468,\n 357,\n 252,\n 220,\n 192,\n 178,\n 148\n ],\n \"SKU_ShortLife\": [\n 125,\n 132,\n 136,\n 149,\n 185,\n 248,\n 318,\n 366,\n 375,\n 542,\n 502,\n 484,\n 374,\n 326,\n 272,\n 224,\n 174,\n 161,\n 121,\n 105\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_ring_routing_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\": 2991.8326868227214, \"DC2\": 2532.9007952808656, \"DC3\": 2608.4258534753153, \"DC4\": 2118.6262010983583, \"DC5\": 2207.6219002477706}, \"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\": [342, 293, 376, 397, 429, 588, 811, 952, 1238, 1392, 1210, 1308, 1038, 1007, 614, 540, 496, 335, 330, 270], \"SKU_Premium\": [135, 140, 159, 203, 203, 238, 356, 489, 624, 593, 583, 576, 608, 468, 357, 252, 220, 192, 178, 148], \"SKU_ShortLife\": [125, 132, 136, 149, 185, 248, 318, 366, 375, 542, 502, 484, 374, 326, 272, 224, 174, 161, 121, 105]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC2\", \"DC3\"], [\"DC3\", \"DC4\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 387984.5} {"scenario_id": "retail_f7_ring_routing_v2", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_ring_routing_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2784.2919716531696,\n \"DC2\": 2460.849040129472,\n \"DC3\": 2434.741837346542,\n \"DC4\": 2443.1677837295156,\n \"DC5\": 1976.9535918402903\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 301,\n 279,\n 325,\n 328,\n 441,\n 563,\n 793,\n 898,\n 1206,\n 1331,\n 1459,\n 1086,\n 1114,\n 998,\n 787,\n 495,\n 462,\n 386,\n 284,\n 332\n ],\n \"SKU_Premium\": [\n 154,\n 165,\n 140,\n 177,\n 185,\n 257,\n 399,\n 429,\n 570,\n 647,\n 555,\n 691,\n 547,\n 442,\n 336,\n 314,\n 228,\n 189,\n 140,\n 157\n ],\n \"SKU_ShortLife\": [\n 110,\n 113,\n 144,\n 129,\n 179,\n 240,\n 260,\n 315,\n 449,\n 525,\n 579,\n 500,\n 378,\n 328,\n 256,\n 220,\n 174,\n 162,\n 127,\n 110\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_ring_routing_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\": 2784.2919716531696, \"DC2\": 2460.849040129472, \"DC3\": 2434.741837346542, \"DC4\": 2443.1677837295156, \"DC5\": 1976.9535918402903}, \"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\": [301, 279, 325, 328, 441, 563, 793, 898, 1206, 1331, 1459, 1086, 1114, 998, 787, 495, 462, 386, 284, 332], \"SKU_Premium\": [154, 165, 140, 177, 185, 257, 399, 429, 570, 647, 555, 691, 547, 442, 336, 314, 228, 189, 140, 157], \"SKU_ShortLife\": [110, 113, 144, 129, 179, 240, 260, 315, 449, 525, 579, 500, 378, 328, 256, 220, 174, 162, 127, 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\": 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\": [[\"DC1\", \"DC2\"], [\"DC2\", \"DC3\"], [\"DC3\", \"DC4\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 383830.0} {"scenario_id": "retail_f7_ring_routing_v3", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_ring_routing_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 2930.9112388773356,\n \"DC2\": 2577.6761352570757,\n \"DC3\": 2199.5198000037785,\n \"DC4\": 2262.2877146418004,\n \"DC5\": 1874.0180327715484\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 337,\n 334,\n 296,\n 367,\n 439,\n 628,\n 694,\n 787,\n 1066,\n 1292,\n 1147,\n 1420,\n 1024,\n 930,\n 669,\n 533,\n 390,\n 328,\n 299,\n 325\n ],\n \"SKU_Premium\": [\n 133,\n 175,\n 183,\n 182,\n 238,\n 297,\n 313,\n 459,\n 603,\n 639,\n 632,\n 541,\n 566,\n 483,\n 383,\n 280,\n 233,\n 180,\n 178,\n 155\n ],\n \"SKU_ShortLife\": [\n 127,\n 106,\n 132,\n 143,\n 173,\n 231,\n 243,\n 391,\n 443,\n 438,\n 568,\n 490,\n 479,\n 383,\n 318,\n 233,\n 195,\n 161,\n 128,\n 133\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_ring_routing_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\": 2930.9112388773356, \"DC2\": 2577.6761352570757, \"DC3\": 2199.5198000037785, \"DC4\": 2262.2877146418004, \"DC5\": 1874.0180327715484}, \"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\": [337, 334, 296, 367, 439, 628, 694, 787, 1066, 1292, 1147, 1420, 1024, 930, 669, 533, 390, 328, 299, 325], \"SKU_Premium\": [133, 175, 183, 182, 238, 297, 313, 459, 603, 639, 632, 541, 566, 483, 383, 280, 233, 180, 178, 155], \"SKU_ShortLife\": [127, 106, 132, 143, 173, 231, 243, 391, 443, 438, 568, 490, 479, 383, 318, 233, 195, 161, 128, 133]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC2\", \"DC3\"], [\"DC3\", \"DC4\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 380527.0} {"scenario_id": "retail_f7_ring_routing_v4", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_ring_routing\nScenario ID: retail_f7_ring_routing_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nLocations are connected in a directed ring, mimicking a truck route that visits each location in a fixed cycle. Inventory can only move along the ring edges, and storage capacities are tightened so that the chosen routing structure affects feasibility and cost. Demand is local and exogenous at each node, and unmet demand is lost and penalized.\n\nStructure cues:\n- The transshipment network in the JSON forms a directed cycle: DC1->DC2->DC3->DC4->DC5->DC1. Inventory can be shipped only along these ring edges.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Capacities are scaled to 80% of normal values.\n- For each product, location, and period, inventory reflects previous stock, local production, inbound ring shipments, outbound ring shipments, sales, and waste, and must remain non-negative.\n- Demand at each location is met from local inventory and inbound ring shipments; there are no shortcuts across the ring.\n- Inventory that moves further along the route must pass through intermediate locations in sequence.\n- Lead times for ring shipments are effectively zero in this archetype, and substitution behavior is as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, lost sales, and transshipment costs) while respecting the ring network structure and tighter storage capacities.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_ring_routing_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3070.401666288584,\n \"DC2\": 2912.4256523689965,\n \"DC3\": 2222.094000824833,\n \"DC4\": 2372.7145024774154,\n \"DC5\": 1839.1810420730599\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 333,\n 332,\n 303,\n 364,\n 376,\n 620,\n 734,\n 972,\n 1246,\n 1404,\n 1159,\n 1189,\n 1052,\n 936,\n 756,\n 560,\n 389,\n 372,\n 337,\n 356\n ],\n \"SKU_Premium\": [\n 168,\n 176,\n 172,\n 167,\n 204,\n 261,\n 349,\n 461,\n 521,\n 669,\n 620,\n 562,\n 480,\n 385,\n 337,\n 279,\n 216,\n 189,\n 174,\n 170\n ],\n \"SKU_ShortLife\": [\n 138,\n 120,\n 123,\n 154,\n 191,\n 214,\n 313,\n 330,\n 487,\n 517,\n 554,\n 561,\n 420,\n 320,\n 293,\n 192,\n 150,\n 126,\n 135,\n 121\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_ring_routing_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\": 3070.401666288584, \"DC2\": 2912.4256523689965, \"DC3\": 2222.094000824833, \"DC4\": 2372.7145024774154, \"DC5\": 1839.1810420730599}, \"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, 332, 303, 364, 376, 620, 734, 972, 1246, 1404, 1159, 1189, 1052, 936, 756, 560, 389, 372, 337, 356], \"SKU_Premium\": [168, 176, 172, 167, 204, 261, 349, 461, 521, 669, 620, 562, 480, 385, 337, 279, 216, 189, 174, 170], \"SKU_ShortLife\": [138, 120, 123, 154, 191, 214, 313, 330, 487, 517, 554, 561, 420, 320, 293, 192, 150, 126, 135, 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\": [[\"DC1\", \"DC2\"], [\"DC2\", \"DC3\"], [\"DC3\", \"DC4\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 377102.0} {"scenario_id": "retail_f7_transshipment_v0", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_transshipment_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ],\n [\n \"DC2\",\n \"DC1\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC2\",\n \"DC4\"\n ],\n [\n \"DC2\",\n \"DC5\"\n ],\n [\n \"DC3\",\n \"DC1\"\n ],\n [\n \"DC3\",\n \"DC2\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC3\",\n \"DC5\"\n ],\n [\n \"DC4\",\n \"DC1\"\n ],\n [\n \"DC4\",\n \"DC2\"\n ],\n [\n \"DC4\",\n \"DC3\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ],\n [\n \"DC5\",\n \"DC2\"\n ],\n [\n \"DC5\",\n \"DC3\"\n ],\n [\n \"DC5\",\n \"DC4\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_transshipment_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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"], [\"DC2\", \"DC1\"], [\"DC2\", \"DC3\"], [\"DC2\", \"DC4\"], [\"DC2\", \"DC5\"], [\"DC3\", \"DC1\"], [\"DC3\", \"DC2\"], [\"DC3\", \"DC4\"], [\"DC3\", \"DC5\"], [\"DC4\", \"DC1\"], [\"DC4\", \"DC2\"], [\"DC4\", \"DC3\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"], [\"DC5\", \"DC2\"], [\"DC5\", \"DC3\"], [\"DC5\", \"DC4\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f7_transshipment_v1", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_transshipment_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4350.379022623083,\n \"DC2\": 4021.4850768661436,\n \"DC3\": 2722.064202033501,\n \"DC4\": 3099.4558270405596,\n \"DC5\": 2284.624833727947\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 346,\n 298,\n 303,\n 409,\n 442,\n 505,\n 724,\n 1015,\n 956,\n 1059,\n 1169,\n 1086,\n 1019,\n 867,\n 769,\n 545,\n 382,\n 342,\n 306,\n 285\n ],\n \"SKU_Premium\": [\n 131,\n 161,\n 187,\n 190,\n 185,\n 290,\n 375,\n 400,\n 508,\n 693,\n 576,\n 670,\n 482,\n 471,\n 310,\n 238,\n 223,\n 176,\n 149,\n 160\n ],\n \"SKU_ShortLife\": [\n 134,\n 127,\n 145,\n 124,\n 185,\n 231,\n 280,\n 370,\n 420,\n 525,\n 518,\n 557,\n 470,\n 380,\n 308,\n 231,\n 180,\n 146,\n 124,\n 115\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ],\n [\n \"DC2\",\n \"DC1\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC2\",\n \"DC4\"\n ],\n [\n \"DC2\",\n \"DC5\"\n ],\n [\n \"DC3\",\n \"DC1\"\n ],\n [\n \"DC3\",\n \"DC2\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC3\",\n \"DC5\"\n ],\n [\n \"DC4\",\n \"DC1\"\n ],\n [\n \"DC4\",\n \"DC2\"\n ],\n [\n \"DC4\",\n \"DC3\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ],\n [\n \"DC5\",\n \"DC2\"\n ],\n [\n \"DC5\",\n \"DC3\"\n ],\n [\n \"DC5\",\n \"DC4\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_transshipment_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\": 4350.379022623083, \"DC2\": 4021.4850768661436, \"DC3\": 2722.064202033501, \"DC4\": 3099.4558270405596, \"DC5\": 2284.624833727947}, \"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\": [346, 298, 303, 409, 442, 505, 724, 1015, 956, 1059, 1169, 1086, 1019, 867, 769, 545, 382, 342, 306, 285], \"SKU_Premium\": [131, 161, 187, 190, 185, 290, 375, 400, 508, 693, 576, 670, 482, 471, 310, 238, 223, 176, 149, 160], \"SKU_ShortLife\": [134, 127, 145, 124, 185, 231, 280, 370, 420, 525, 518, 557, 470, 380, 308, 231, 180, 146, 124, 115]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"], [\"DC2\", \"DC1\"], [\"DC2\", \"DC3\"], [\"DC2\", \"DC4\"], [\"DC2\", \"DC5\"], [\"DC3\", \"DC1\"], [\"DC3\", \"DC2\"], [\"DC3\", \"DC4\"], [\"DC3\", \"DC5\"], [\"DC4\", \"DC1\"], [\"DC4\", \"DC2\"], [\"DC4\", \"DC3\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"], [\"DC5\", \"DC2\"], [\"DC5\", \"DC3\"], [\"DC5\", \"DC4\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 364495.5} {"scenario_id": "retail_f7_transshipment_v2", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_transshipment_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4285.991673328941,\n \"DC2\": 3618.6622567015015,\n \"DC3\": 2927.394970495998,\n \"DC4\": 3260.5659553845603,\n \"DC5\": 2489.40749898572\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 314,\n 273,\n 309,\n 404,\n 485,\n 598,\n 760,\n 820,\n 1161,\n 1358,\n 1378,\n 1060,\n 1054,\n 874,\n 758,\n 596,\n 433,\n 325,\n 347,\n 307\n ],\n \"SKU_Premium\": [\n 139,\n 156,\n 176,\n 172,\n 226,\n 313,\n 377,\n 505,\n 571,\n 702,\n 631,\n 628,\n 565,\n 430,\n 399,\n 275,\n 204,\n 171,\n 163,\n 133\n ],\n \"SKU_ShortLife\": [\n 126,\n 122,\n 122,\n 161,\n 167,\n 221,\n 280,\n 400,\n 472,\n 512,\n 583,\n 492,\n 429,\n 367,\n 269,\n 225,\n 149,\n 159,\n 147,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ],\n [\n \"DC2\",\n \"DC1\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC2\",\n \"DC4\"\n ],\n [\n \"DC2\",\n \"DC5\"\n ],\n [\n \"DC3\",\n \"DC1\"\n ],\n [\n \"DC3\",\n \"DC2\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC3\",\n \"DC5\"\n ],\n [\n \"DC4\",\n \"DC1\"\n ],\n [\n \"DC4\",\n \"DC2\"\n ],\n [\n \"DC4\",\n \"DC3\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ],\n [\n \"DC5\",\n \"DC2\"\n ],\n [\n \"DC5\",\n \"DC3\"\n ],\n [\n \"DC5\",\n \"DC4\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_transshipment_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\": 4285.991673328941, \"DC2\": 3618.6622567015015, \"DC3\": 2927.394970495998, \"DC4\": 3260.5659553845603, \"DC5\": 2489.40749898572}, \"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\": [314, 273, 309, 404, 485, 598, 760, 820, 1161, 1358, 1378, 1060, 1054, 874, 758, 596, 433, 325, 347, 307], \"SKU_Premium\": [139, 156, 176, 172, 226, 313, 377, 505, 571, 702, 631, 628, 565, 430, 399, 275, 204, 171, 163, 133], \"SKU_ShortLife\": [126, 122, 122, 161, 167, 221, 280, 400, 472, 512, 583, 492, 429, 367, 269, 225, 149, 159, 147, 119]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"], [\"DC2\", \"DC1\"], [\"DC2\", \"DC3\"], [\"DC2\", \"DC4\"], [\"DC2\", \"DC5\"], [\"DC3\", \"DC1\"], [\"DC3\", \"DC2\"], [\"DC3\", \"DC4\"], [\"DC3\", \"DC5\"], [\"DC4\", \"DC1\"], [\"DC4\", \"DC2\"], [\"DC4\", \"DC3\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"], [\"DC5\", \"DC2\"], [\"DC5\", \"DC3\"], [\"DC5\", \"DC4\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 387474.0} {"scenario_id": "retail_f7_transshipment_v3", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_transshipment_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4013.8626163637355,\n \"DC2\": 3484.8019383571614,\n \"DC3\": 3037.478329781149,\n \"DC4\": 3425.155086535567,\n \"DC5\": 2394.032525917858\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 272,\n 318,\n 285,\n 338,\n 441,\n 598,\n 759,\n 782,\n 1120,\n 1319,\n 1395,\n 1199,\n 1149,\n 849,\n 751,\n 553,\n 490,\n 356,\n 286,\n 305\n ],\n \"SKU_Premium\": [\n 130,\n 162,\n 157,\n 193,\n 214,\n 270,\n 341,\n 505,\n 628,\n 596,\n 583,\n 613,\n 567,\n 481,\n 347,\n 266,\n 225,\n 164,\n 179,\n 148\n ],\n \"SKU_ShortLife\": [\n 121,\n 107,\n 139,\n 161,\n 183,\n 199,\n 310,\n 366,\n 409,\n 452,\n 581,\n 555,\n 459,\n 318,\n 264,\n 240,\n 174,\n 138,\n 148,\n 116\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ],\n [\n \"DC2\",\n \"DC1\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC2\",\n \"DC4\"\n ],\n [\n \"DC2\",\n \"DC5\"\n ],\n [\n \"DC3\",\n \"DC1\"\n ],\n [\n \"DC3\",\n \"DC2\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC3\",\n \"DC5\"\n ],\n [\n \"DC4\",\n \"DC1\"\n ],\n [\n \"DC4\",\n \"DC2\"\n ],\n [\n \"DC4\",\n \"DC3\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ],\n [\n \"DC5\",\n \"DC2\"\n ],\n [\n \"DC5\",\n \"DC3\"\n ],\n [\n \"DC5\",\n \"DC4\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_transshipment_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\": 4013.8626163637355, \"DC2\": 3484.8019383571614, \"DC3\": 3037.478329781149, \"DC4\": 3425.155086535567, \"DC5\": 2394.032525917858}, \"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\": [272, 318, 285, 338, 441, 598, 759, 782, 1120, 1319, 1395, 1199, 1149, 849, 751, 553, 490, 356, 286, 305], \"SKU_Premium\": [130, 162, 157, 193, 214, 270, 341, 505, 628, 596, 583, 613, 567, 481, 347, 266, 225, 164, 179, 148], \"SKU_ShortLife\": [121, 107, 139, 161, 183, 199, 310, 366, 409, 452, 581, 555, 459, 318, 264, 240, 174, 138, 148, 116]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"], [\"DC2\", \"DC1\"], [\"DC2\", \"DC3\"], [\"DC2\", \"DC4\"], [\"DC2\", \"DC5\"], [\"DC3\", \"DC1\"], [\"DC3\", \"DC2\"], [\"DC3\", \"DC4\"], [\"DC3\", \"DC5\"], [\"DC4\", \"DC1\"], [\"DC4\", \"DC2\"], [\"DC4\", \"DC3\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"], [\"DC5\", \"DC2\"], [\"DC5\", \"DC3\"], [\"DC5\", \"DC4\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 382278.0} {"scenario_id": "retail_f7_transshipment_v4", "prompt_schema": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F7 (Network and Multi Echelon)\nArchetype: retail_f7_transshipment\nScenario ID: retail_f7_transshipment_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates a fully connected lateral transshipment network among all locations. Inventory can be moved between any pair of locations at a transshipment cost, allowing local surpluses to be reallocated to locations facing shortages. Demand remains local and exogenous at each site, and unsatisfied demand after considering local stock and inbound transshipments is lost and penalized.\n\nStructure cues:\n- This archetype extends the single-echelon inventory model by allowing transshipment flows along directed edges given in the JSON; in this case, all ordered pairs of distinct locations are connected (full network).\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected at each location.\n- For each product and period, inventory at a location changes according to incoming production, incoming transshipments, outgoing transshipments, sales, and waste, and must remain non-negative.\n- Transshipment flows from a location in a period cannot exceed that location's available inventory for the product. All such moves incur transshipment costs as specified in the JSON.\n- Demand remains local: each location's demand must be met from its own on-hand inventory and inbound transshipments, if available.\n- Lead times for transshipment are effectively zero in this archetype, so shipments dispatched in a period are available at the destination within the same period.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and transshipment costs.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f7_transshipment_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4358.239604043874,\n \"DC2\": 3435.3130461780443,\n \"DC3\": 3247.1030467862815,\n \"DC4\": 3369.300722713695,\n \"DC5\": 2795.7905924543456\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 326,\n 309,\n 337,\n 394,\n 371,\n 583,\n 779,\n 778,\n 1058,\n 1401,\n 1471,\n 1167,\n 1155,\n 944,\n 621,\n 618,\n 413,\n 417,\n 343,\n 302\n ],\n \"SKU_Premium\": [\n 156,\n 155,\n 140,\n 206,\n 202,\n 268,\n 321,\n 402,\n 514,\n 549,\n 635,\n 585,\n 606,\n 486,\n 402,\n 273,\n 236,\n 169,\n 177,\n 140\n ],\n \"SKU_ShortLife\": [\n 113,\n 122,\n 127,\n 167,\n 157,\n 249,\n 320,\n 367,\n 489,\n 521,\n 548,\n 527,\n 383,\n 388,\n 302,\n 243,\n 193,\n 129,\n 129,\n 133\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": [\n [\n \"DC1\",\n \"DC2\"\n ],\n [\n \"DC1\",\n \"DC3\"\n ],\n [\n \"DC1\",\n \"DC4\"\n ],\n [\n \"DC1\",\n \"DC5\"\n ],\n [\n \"DC2\",\n \"DC1\"\n ],\n [\n \"DC2\",\n \"DC3\"\n ],\n [\n \"DC2\",\n \"DC4\"\n ],\n [\n \"DC2\",\n \"DC5\"\n ],\n [\n \"DC3\",\n \"DC1\"\n ],\n [\n \"DC3\",\n \"DC2\"\n ],\n [\n \"DC3\",\n \"DC4\"\n ],\n [\n \"DC3\",\n \"DC5\"\n ],\n [\n \"DC4\",\n \"DC1\"\n ],\n [\n \"DC4\",\n \"DC2\"\n ],\n [\n \"DC4\",\n \"DC3\"\n ],\n [\n \"DC4\",\n \"DC5\"\n ],\n [\n \"DC5\",\n \"DC1\"\n ],\n [\n \"DC5\",\n \"DC2\"\n ],\n [\n \"DC5\",\n \"DC3\"\n ],\n [\n \"DC5\",\n \"DC4\"\n ]\n ]\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f7_transshipment_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\": 4358.239604043874, \"DC2\": 3435.3130461780443, \"DC3\": 3247.1030467862815, \"DC4\": 3369.300722713695, \"DC5\": 2795.7905924543456}, \"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\": [326, 309, 337, 394, 371, 583, 779, 778, 1058, 1401, 1471, 1167, 1155, 944, 621, 618, 413, 417, 343, 302], \"SKU_Premium\": [156, 155, 140, 206, 202, 268, 321, 402, 514, 549, 635, 585, 606, 486, 402, 273, 236, 169, 177, 140], \"SKU_ShortLife\": [113, 122, 127, 167, 157, 249, 320, 367, 489, 521, 548, 527, 383, 388, 302, 243, 193, 129, 129, 133]}, \"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\": [[\"DC1\", \"DC2\"], [\"DC1\", \"DC3\"], [\"DC1\", \"DC4\"], [\"DC1\", \"DC5\"], [\"DC2\", \"DC1\"], [\"DC2\", \"DC3\"], [\"DC2\", \"DC4\"], [\"DC2\", \"DC5\"], [\"DC3\", \"DC1\"], [\"DC3\", \"DC2\"], [\"DC3\", \"DC4\"], [\"DC3\", \"DC5\"], [\"DC4\", \"DC1\"], [\"DC4\", \"DC2\"], [\"DC4\", \"DC3\"], [\"DC4\", \"DC5\"], [\"DC5\", \"DC1\"], [\"DC5\", \"DC2\"], [\"DC5\", \"DC3\"], [\"DC5\", \"DC4\"]]}}", "reference_status": "OPTIMAL", "reference_objective": 384023.0} {"scenario_id": "retail_f8_labor_constraint_v0", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_labor_constraint_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC4\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC5\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.1,\n \"SKU_Premium\": 0.2,\n \"SKU_ShortLife\": 0.1\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_labor_constraint_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\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC4\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC5\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]}, \"labor_usage\": {\"SKU_Basic\": 0.1, \"SKU_Premium\": 0.2, \"SKU_ShortLife\": 0.1}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f8_labor_constraint_v1", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_labor_constraint_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4310.192866765159,\n \"DC2\": 3588.9446181846233,\n \"DC3\": 3078.491264565844,\n \"DC4\": 2735.6586435926997,\n \"DC5\": 2174.3596340257195\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC4\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC5\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.1,\n \"SKU_Premium\": 0.2,\n \"SKU_ShortLife\": 0.1\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 335,\n 325,\n 319,\n 368,\n 404,\n 623,\n 779,\n 1023,\n 946,\n 1349,\n 1346,\n 1378,\n 1059,\n 902,\n 641,\n 620,\n 437,\n 368,\n 279,\n 327\n ],\n \"SKU_Premium\": [\n 169,\n 140,\n 165,\n 157,\n 190,\n 265,\n 401,\n 434,\n 492,\n 580,\n 672,\n 543,\n 618,\n 425,\n 396,\n 270,\n 211,\n 187,\n 172,\n 145\n ],\n \"SKU_ShortLife\": [\n 119,\n 110,\n 136,\n 150,\n 153,\n 199,\n 263,\n 405,\n 469,\n 527,\n 534,\n 442,\n 502,\n 337,\n 243,\n 240,\n 161,\n 137,\n 121,\n 121\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_labor_constraint_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\": 4310.192866765159, \"DC2\": 3588.9446181846233, \"DC3\": 3078.491264565844, \"DC4\": 2735.6586435926997, \"DC5\": 2174.3596340257195}, \"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\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC4\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC5\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]}, \"labor_usage\": {\"SKU_Basic\": 0.1, \"SKU_Premium\": 0.2, \"SKU_ShortLife\": 0.1}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [335, 325, 319, 368, 404, 623, 779, 1023, 946, 1349, 1346, 1378, 1059, 902, 641, 620, 437, 368, 279, 327], \"SKU_Premium\": [169, 140, 165, 157, 190, 265, 401, 434, 492, 580, 672, 543, 618, 425, 396, 270, 211, 187, 172, 145], \"SKU_ShortLife\": [119, 110, 136, 150, 153, 199, 263, 405, 469, 527, 534, 442, 502, 337, 243, 240, 161, 137, 121, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 380643.0} {"scenario_id": "retail_f8_labor_constraint_v2", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_labor_constraint_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4592.36905464421,\n \"DC2\": 3554.653451783283,\n \"DC3\": 3338.364204636388,\n \"DC4\": 2697.9451449916437,\n \"DC5\": 2538.7956365381124\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC4\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC5\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.1,\n \"SKU_Premium\": 0.2,\n \"SKU_ShortLife\": 0.1\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 263,\n 274,\n 288,\n 333,\n 491,\n 576,\n 732,\n 1036,\n 1119,\n 1123,\n 1221,\n 1370,\n 1017,\n 885,\n 705,\n 480,\n 420,\n 395,\n 322,\n 273\n ],\n \"SKU_Premium\": [\n 148,\n 167,\n 154,\n 172,\n 191,\n 300,\n 340,\n 479,\n 528,\n 601,\n 674,\n 611,\n 478,\n 430,\n 323,\n 235,\n 232,\n 159,\n 150,\n 170\n ],\n \"SKU_ShortLife\": [\n 129,\n 115,\n 113,\n 162,\n 194,\n 207,\n 258,\n 412,\n 435,\n 459,\n 528,\n 516,\n 413,\n 405,\n 317,\n 218,\n 197,\n 154,\n 140,\n 129\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_labor_constraint_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\": 4592.36905464421, \"DC2\": 3554.653451783283, \"DC3\": 3338.364204636388, \"DC4\": 2697.9451449916437, \"DC5\": 2538.7956365381124}, \"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\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC4\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC5\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]}, \"labor_usage\": {\"SKU_Basic\": 0.1, \"SKU_Premium\": 0.2, \"SKU_ShortLife\": 0.1}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [263, 274, 288, 333, 491, 576, 732, 1036, 1119, 1123, 1221, 1370, 1017, 885, 705, 480, 420, 395, 322, 273], \"SKU_Premium\": [148, 167, 154, 172, 191, 300, 340, 479, 528, 601, 674, 611, 478, 430, 323, 235, 232, 159, 150, 170], \"SKU_ShortLife\": [129, 115, 113, 162, 194, 207, 258, 412, 435, 459, 528, 516, 413, 405, 317, 218, 197, 154, 140, 129]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 372347.5} {"scenario_id": "retail_f8_labor_constraint_v3", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_labor_constraint_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3646.8964883007843,\n \"DC2\": 3066.769163887492,\n \"DC3\": 2618.4992511899977,\n \"DC4\": 3372.5940820382807,\n \"DC5\": 2412.6346089600183\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC4\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC5\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.1,\n \"SKU_Premium\": 0.2,\n \"SKU_ShortLife\": 0.1\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 258,\n 321,\n 326,\n 340,\n 480,\n 620,\n 638,\n 948,\n 1233,\n 1275,\n 1326,\n 1214,\n 1008,\n 813,\n 692,\n 500,\n 494,\n 341,\n 358,\n 293\n ],\n \"SKU_Premium\": [\n 143,\n 158,\n 155,\n 204,\n 204,\n 239,\n 391,\n 392,\n 576,\n 594,\n 687,\n 586,\n 516,\n 460,\n 392,\n 293,\n 231,\n 182,\n 150,\n 169\n ],\n \"SKU_ShortLife\": [\n 136,\n 139,\n 126,\n 155,\n 165,\n 236,\n 295,\n 342,\n 432,\n 430,\n 521,\n 504,\n 439,\n 361,\n 297,\n 193,\n 191,\n 145,\n 142,\n 120\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_labor_constraint_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\": 3646.8964883007843, \"DC2\": 3066.769163887492, \"DC3\": 2618.4992511899977, \"DC4\": 3372.5940820382807, \"DC5\": 2412.6346089600183}, \"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\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC4\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC5\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]}, \"labor_usage\": {\"SKU_Basic\": 0.1, \"SKU_Premium\": 0.2, \"SKU_ShortLife\": 0.1}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [258, 321, 326, 340, 480, 620, 638, 948, 1233, 1275, 1326, 1214, 1008, 813, 692, 500, 494, 341, 358, 293], \"SKU_Premium\": [143, 158, 155, 204, 204, 239, 391, 392, 576, 594, 687, 586, 516, 460, 392, 293, 231, 182, 150, 169], \"SKU_ShortLife\": [136, 139, 126, 155, 165, 236, 295, 342, 432, 430, 521, 504, 439, 361, 297, 193, 191, 145, 142, 120]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 375970.5} {"scenario_id": "retail_f8_labor_constraint_v4", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_labor_constraint\nScenario ID: retail_f8_labor_constraint_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStore and warehouse labor capacity directly limits how much inventory can be handled in each period. Labor is required for activities such as receiving, picking, and replenishment, and total labor usage per period at a location cannot exceed a location-specific cap. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory system is single-echelon with production, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- Labor capacity: The JSON provides labor_cap=200 per location per period, and labor_usage per product (SKU_Basic=0.1, SKU_Premium=0.2, SKU_ShortLife=0.1). Total labor consumed at a location in a period must not exceed this capacity: sum over products of (labor_usage[p] * units_handled[p,l,t]) <= labor_cap[l,t].\n- A simple representation is to treat labor usage as proportional to the volume of units handled, such as the sum of units received, picked, or moved for that product and period.\n- Inventory balance follows the usual pattern: previous stock plus arrivals minus sales and waste, with non-negative inventory and lost sales for unmet demand.\n- There is no transshipment in this archetype.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while respecting labor capacity constraints, which may bind in busy periods.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_labor_constraint_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3439.2155961756234,\n \"DC2\": 3931.9062829180048,\n \"DC3\": 3326.0069329915777,\n \"DC4\": 3311.159069764675,\n \"DC5\": 2127.050410335305\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC2\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC3\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC4\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ],\n \"DC5\": [\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0,\n 200.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.1,\n \"SKU_Premium\": 0.2,\n \"SKU_ShortLife\": 0.1\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 329,\n 317,\n 292,\n 328,\n 394,\n 568,\n 646,\n 949,\n 1225,\n 1154,\n 1448,\n 1248,\n 1043,\n 911,\n 683,\n 567,\n 431,\n 398,\n 308,\n 307\n ],\n \"SKU_Premium\": [\n 149,\n 137,\n 173,\n 158,\n 220,\n 242,\n 356,\n 493,\n 557,\n 669,\n 583,\n 700,\n 476,\n 517,\n 384,\n 293,\n 230,\n 192,\n 140,\n 168\n ],\n \"SKU_ShortLife\": [\n 131,\n 113,\n 148,\n 153,\n 177,\n 232,\n 254,\n 353,\n 465,\n 494,\n 568,\n 532,\n 413,\n 386,\n 256,\n 216,\n 187,\n 140,\n 148,\n 141\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_labor_constraint_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\": 3439.2155961756234, \"DC2\": 3931.9062829180048, \"DC3\": 3326.0069329915777, \"DC4\": 3311.159069764675, \"DC5\": 2127.050410335305}, \"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\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC2\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC3\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC4\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0], \"DC5\": [200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]}, \"labor_usage\": {\"SKU_Basic\": 0.1, \"SKU_Premium\": 0.2, \"SKU_ShortLife\": 0.1}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [329, 317, 292, 328, 394, 568, 646, 949, 1225, 1154, 1448, 1248, 1043, 911, 683, 567, 431, 398, 308, 307], \"SKU_Premium\": [149, 137, 173, 158, 220, 242, 356, 493, 557, 669, 583, 700, 476, 517, 384, 293, 230, 192, 140, 168], \"SKU_ShortLife\": [131, 113, 148, 153, 177, 232, 254, 353, 465, 494, 568, 532, 413, 386, 256, 216, 187, 140, 148, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 384874.0} {"scenario_id": "retail_f8_reverse_logistics_v0", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_reverse_logistics_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.2,\n \"SKU_Premium\": 0.1,\n \"SKU_ShortLife\": 0.05\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_reverse_logistics_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.2, \"SKU_Premium\": 0.1, \"SKU_ShortLife\": 0.05}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 317794.15} {"scenario_id": "retail_f8_reverse_logistics_v1", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_reverse_logistics_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3585.119991163064,\n \"DC2\": 3543.95151284518,\n \"DC3\": 2788.4869478430355,\n \"DC4\": 3409.9070019682895,\n \"DC5\": 2859.693751057975\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.2,\n \"SKU_Premium\": 0.1,\n \"SKU_ShortLife\": 0.05\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 273,\n 314,\n 298,\n 330,\n 371,\n 527,\n 785,\n 850,\n 1078,\n 1272,\n 1284,\n 1186,\n 1060,\n 860,\n 741,\n 584,\n 433,\n 326,\n 343,\n 333\n ],\n \"SKU_Premium\": [\n 147,\n 154,\n 183,\n 183,\n 242,\n 270,\n 332,\n 456,\n 624,\n 623,\n 570,\n 621,\n 510,\n 418,\n 322,\n 278,\n 241,\n 207,\n 154,\n 148\n ],\n \"SKU_ShortLife\": [\n 120,\n 110,\n 144,\n 127,\n 157,\n 247,\n 314,\n 393,\n 456,\n 472,\n 489,\n 528,\n 412,\n 313,\n 280,\n 196,\n 181,\n 151,\n 125,\n 138\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_reverse_logistics_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\": 3585.119991163064, \"DC2\": 3543.95151284518, \"DC3\": 2788.4869478430355, \"DC4\": 3409.9070019682895, \"DC5\": 2859.693751057975}, \"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.2, \"SKU_Premium\": 0.1, \"SKU_ShortLife\": 0.05}, \"demand_curve\": {\"SKU_Basic\": [273, 314, 298, 330, 371, 527, 785, 850, 1078, 1272, 1284, 1186, 1060, 860, 741, 584, 433, 326, 343, 333], \"SKU_Premium\": [147, 154, 183, 183, 242, 270, 332, 456, 624, 623, 570, 621, 510, 418, 322, 278, 241, 207, 154, 148], \"SKU_ShortLife\": [120, 110, 144, 127, 157, 247, 314, 393, 456, 472, 489, 528, 412, 313, 280, 196, 181, 151, 125, 138]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 312438.75} {"scenario_id": "retail_f8_reverse_logistics_v2", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_reverse_logistics_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3889.727022600189,\n \"DC2\": 3149.294946397292,\n \"DC3\": 2913.7117996204165,\n \"DC4\": 2762.551520869589,\n \"DC5\": 2558.1965531202823\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.2,\n \"SKU_Premium\": 0.1,\n \"SKU_ShortLife\": 0.05\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 336,\n 276,\n 372,\n 391,\n 490,\n 575,\n 748,\n 922,\n 1104,\n 1189,\n 1142,\n 1102,\n 1110,\n 780,\n 733,\n 598,\n 402,\n 321,\n 349,\n 307\n ],\n \"SKU_Premium\": [\n 164,\n 133,\n 177,\n 164,\n 237,\n 247,\n 375,\n 394,\n 518,\n 558,\n 617,\n 593,\n 499,\n 473,\n 318,\n 254,\n 198,\n 182,\n 186,\n 174\n ],\n \"SKU_ShortLife\": [\n 124,\n 131,\n 139,\n 128,\n 155,\n 239,\n 308,\n 332,\n 400,\n 541,\n 567,\n 438,\n 477,\n 364,\n 308,\n 189,\n 152,\n 155,\n 139,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_reverse_logistics_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\": 3889.727022600189, \"DC2\": 3149.294946397292, \"DC3\": 2913.7117996204165, \"DC4\": 2762.551520869589, \"DC5\": 2558.1965531202823}, \"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.2, \"SKU_Premium\": 0.1, \"SKU_ShortLife\": 0.05}, \"demand_curve\": {\"SKU_Basic\": [336, 276, 372, 391, 490, 575, 748, 922, 1104, 1189, 1142, 1102, 1110, 780, 733, 598, 402, 321, 349, 307], \"SKU_Premium\": [164, 133, 177, 164, 237, 247, 375, 394, 518, 558, 617, 593, 499, 473, 318, 254, 198, 182, 186, 174], \"SKU_ShortLife\": [124, 131, 139, 128, 155, 239, 308, 332, 400, 541, 567, 438, 477, 364, 308, 189, 152, 155, 139, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 307341.3} {"scenario_id": "retail_f8_reverse_logistics_v3", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_reverse_logistics_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4173.542295425565,\n \"DC2\": 3663.584247257512,\n \"DC3\": 3305.921642354087,\n \"DC4\": 2881.7588645231726,\n \"DC5\": 2588.8818265972945\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.2,\n \"SKU_Premium\": 0.1,\n \"SKU_ShortLife\": 0.05\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 301,\n 295,\n 319,\n 312,\n 460,\n 606,\n 629,\n 869,\n 973,\n 1323,\n 1289,\n 1345,\n 1021,\n 898,\n 748,\n 553,\n 468,\n 339,\n 312,\n 335\n ],\n \"SKU_Premium\": [\n 152,\n 132,\n 186,\n 181,\n 195,\n 253,\n 381,\n 457,\n 525,\n 636,\n 552,\n 566,\n 492,\n 440,\n 406,\n 304,\n 192,\n 169,\n 153,\n 161\n ],\n \"SKU_ShortLife\": [\n 136,\n 110,\n 146,\n 133,\n 170,\n 204,\n 325,\n 375,\n 380,\n 490,\n 548,\n 553,\n 392,\n 392,\n 273,\n 250,\n 164,\n 141,\n 120,\n 125\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_reverse_logistics_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\": 4173.542295425565, \"DC2\": 3663.584247257512, \"DC3\": 3305.921642354087, \"DC4\": 2881.7588645231726, \"DC5\": 2588.8818265972945}, \"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.2, \"SKU_Premium\": 0.1, \"SKU_ShortLife\": 0.05}, \"demand_curve\": {\"SKU_Basic\": [301, 295, 319, 312, 460, 606, 629, 869, 973, 1323, 1289, 1345, 1021, 898, 748, 553, 468, 339, 312, 335], \"SKU_Premium\": [152, 132, 186, 181, 195, 253, 381, 457, 525, 636, 552, 566, 492, 440, 406, 304, 192, 169, 153, 161], \"SKU_ShortLife\": [136, 110, 146, 133, 170, 204, 325, 375, 380, 490, 548, 553, 392, 392, 273, 250, 164, 141, 120, 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\": 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 311285.95} {"scenario_id": "retail_f8_reverse_logistics_v4", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_reverse_logistics\nScenario ID: retail_f8_reverse_logistics_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nA fraction of units sold in each period are returned by customers in the next period and re-enter inventory as reverse flow. Returns are product-specific and location-specific, and can be used to satisfy future demand as long as they have not expired or violated storage limits. Demand is local and exogenous; unmet demand is lost and penalized.\n\nStructure cues:\n- The system is single-echelon with production, storage, and lost sales, extended to include reverse flows from returns.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1) Returned units re-enter as age-1 inventory.\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits apply to all inventory including returns.\n- The JSON specifies return rates: SKU_Basic=20%, SKU_Premium=10%, SKU_ShortLife=5%. For each product and location, this fraction of units sold in one period re-enters as usable inventory at the same location in the next period.\n- Inventory at each period includes previous stock, current production, and returns from prior sales, minus current-period sales and waste, and must remain non-negative.\n- There is no transshipment in this archetype, and lead times for production are zero.\n- The objective is to minimize total cost including purchasing, holding, waste, lost sales, and any indirect effect of handling returns as captured in the cost parameters.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_reverse_logistics_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3705.048324276536,\n \"DC2\": 3304.9990829816993,\n \"DC3\": 2739.9805929668423,\n \"DC4\": 2988.5097424290234,\n \"DC5\": 2194.0782375555723\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.2,\n \"SKU_Premium\": 0.1,\n \"SKU_ShortLife\": 0.05\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 282,\n 345,\n 370,\n 408,\n 395,\n 609,\n 648,\n 883,\n 1114,\n 1358,\n 1404,\n 1120,\n 1179,\n 836,\n 787,\n 484,\n 428,\n 364,\n 313,\n 285\n ],\n \"SKU_Premium\": [\n 130,\n 150,\n 160,\n 157,\n 202,\n 249,\n 398,\n 485,\n 600,\n 623,\n 568,\n 706,\n 501,\n 447,\n 365,\n 302,\n 244,\n 202,\n 143,\n 176\n ],\n \"SKU_ShortLife\": [\n 110,\n 141,\n 128,\n 136,\n 177,\n 206,\n 300,\n 407,\n 377,\n 458,\n 449,\n 505,\n 410,\n 359,\n 287,\n 232,\n 197,\n 142,\n 117,\n 105\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_reverse_logistics_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\": 3705.048324276536, \"DC2\": 3304.9990829816993, \"DC3\": 2739.9805929668423, \"DC4\": 2988.5097424290234, \"DC5\": 2194.0782375555723}, \"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.2, \"SKU_Premium\": 0.1, \"SKU_ShortLife\": 0.05}, \"demand_curve\": {\"SKU_Basic\": [282, 345, 370, 408, 395, 609, 648, 883, 1114, 1358, 1404, 1120, 1179, 836, 787, 484, 428, 364, 313, 285], \"SKU_Premium\": [130, 150, 160, 157, 202, 249, 398, 485, 600, 623, 568, 706, 501, 447, 365, 302, 244, 202, 143, 176], \"SKU_ShortLife\": [110, 141, 128, 136, 177, 206, 300, 407, 377, 458, 449, 505, 410, 359, 287, 232, 197, 142, 117, 105]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 318471.7} {"scenario_id": "retail_f8_ship_from_store_v0", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_ship_from_store_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 20000.0,\n \"DC2\": 17500.0,\n \"DC3\": 15000.0,\n \"DC4\": 15000.0,\n \"DC5\": 12500.0\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC3\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC4\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC5\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 0.8,\n \"SKU_ShortLife\": 0.6\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_ship_from_store_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\": 20000.0, \"DC2\": 17500.0, \"DC3\": 15000.0, \"DC4\": 15000.0, \"DC5\": 12500.0}, \"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\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC3\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC4\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC5\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0]}, \"labor_usage\": {\"SKU_Basic\": 0.5, \"SKU_Premium\": 0.8, \"SKU_ShortLife\": 0.6}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f8_ship_from_store_v1", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_ship_from_store_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 18644.66911283837,\n \"DC2\": 14884.091527897905,\n \"DC3\": 13361.469248022557,\n \"DC4\": 16545.024525742112,\n \"DC5\": 10717.415310668213\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC3\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC4\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC5\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 0.8,\n \"SKU_ShortLife\": 0.6\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 318,\n 308,\n 321,\n 414,\n 495,\n 494,\n 762,\n 867,\n 1210,\n 1407,\n 1444,\n 1155,\n 1026,\n 970,\n 746,\n 555,\n 395,\n 404,\n 307,\n 271\n ],\n \"SKU_Premium\": [\n 167,\n 157,\n 140,\n 208,\n 207,\n 289,\n 342,\n 494,\n 619,\n 635,\n 711,\n 713,\n 495,\n 424,\n 336,\n 238,\n 217,\n 163,\n 146,\n 167\n ],\n \"SKU_ShortLife\": [\n 112,\n 140,\n 145,\n 128,\n 191,\n 207,\n 293,\n 379,\n 410,\n 550,\n 447,\n 528,\n 396,\n 316,\n 298,\n 229,\n 177,\n 136,\n 129,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_ship_from_store_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\": 18644.66911283837, \"DC2\": 14884.091527897905, \"DC3\": 13361.469248022557, \"DC4\": 16545.024525742112, \"DC5\": 10717.415310668213}, \"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\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC3\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC4\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC5\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0]}, \"labor_usage\": {\"SKU_Basic\": 0.5, \"SKU_Premium\": 0.8, \"SKU_ShortLife\": 0.6}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [318, 308, 321, 414, 495, 494, 762, 867, 1210, 1407, 1444, 1155, 1026, 970, 746, 555, 395, 404, 307, 271], \"SKU_Premium\": [167, 157, 140, 208, 207, 289, 342, 494, 619, 635, 711, 713, 495, 424, 336, 238, 217, 163, 146, 167], \"SKU_ShortLife\": [112, 140, 145, 128, 191, 207, 293, 379, 410, 550, 447, 528, 396, 316, 298, 229, 177, 136, 129, 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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 389360.5} {"scenario_id": "retail_f8_ship_from_store_v2", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_ship_from_store_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 21761.30120298466,\n \"DC2\": 18696.04155263683,\n \"DC3\": 12960.70932455476,\n \"DC4\": 17184.98572664997,\n \"DC5\": 13938.915790310666\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC3\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC4\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC5\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 0.8,\n \"SKU_ShortLife\": 0.6\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 264,\n 271,\n 284,\n 384,\n 423,\n 491,\n 769,\n 828,\n 1054,\n 1136,\n 1156,\n 1182,\n 1087,\n 802,\n 723,\n 572,\n 454,\n 358,\n 370,\n 303\n ],\n \"SKU_Premium\": [\n 159,\n 162,\n 154,\n 164,\n 236,\n 307,\n 408,\n 502,\n 587,\n 682,\n 581,\n 646,\n 467,\n 402,\n 405,\n 278,\n 196,\n 190,\n 159,\n 175\n ],\n \"SKU_ShortLife\": [\n 114,\n 127,\n 139,\n 163,\n 190,\n 186,\n 264,\n 315,\n 421,\n 464,\n 565,\n 518,\n 384,\n 330,\n 251,\n 249,\n 175,\n 130,\n 150,\n 119\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_ship_from_store_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\": 21761.30120298466, \"DC2\": 18696.04155263683, \"DC3\": 12960.70932455476, \"DC4\": 17184.98572664997, \"DC5\": 13938.915790310666}, \"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\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC3\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC4\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC5\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0]}, \"labor_usage\": {\"SKU_Basic\": 0.5, \"SKU_Premium\": 0.8, \"SKU_ShortLife\": 0.6}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [264, 271, 284, 384, 423, 491, 769, 828, 1054, 1136, 1156, 1182, 1087, 802, 723, 572, 454, 358, 370, 303], \"SKU_Premium\": [159, 162, 154, 164, 236, 307, 408, 502, 587, 682, 581, 646, 467, 402, 405, 278, 196, 190, 159, 175], \"SKU_ShortLife\": [114, 127, 139, 163, 190, 186, 264, 315, 421, 464, 565, 518, 384, 330, 251, 249, 175, 130, 150, 119]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 367720.5} {"scenario_id": "retail_f8_ship_from_store_v3", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_ship_from_store_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 21566.005991410428,\n \"DC2\": 16049.495114637843,\n \"DC3\": 14678.295265873165,\n \"DC4\": 15179.345470283368,\n \"DC5\": 12417.872804445959\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC3\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC4\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC5\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 0.8,\n \"SKU_ShortLife\": 0.6\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 260,\n 315,\n 284,\n 333,\n 384,\n 549,\n 750,\n 913,\n 1084,\n 1422,\n 1490,\n 1136,\n 1239,\n 894,\n 775,\n 547,\n 372,\n 373,\n 295,\n 349\n ],\n \"SKU_Premium\": [\n 140,\n 170,\n 167,\n 174,\n 216,\n 299,\n 402,\n 461,\n 541,\n 675,\n 576,\n 704,\n 495,\n 448,\n 384,\n 247,\n 234,\n 156,\n 163,\n 147\n ],\n \"SKU_ShortLife\": [\n 104,\n 116,\n 140,\n 161,\n 159,\n 220,\n 294,\n 350,\n 451,\n 501,\n 535,\n 469,\n 465,\n 359,\n 300,\n 238,\n 176,\n 128,\n 114,\n 128\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_ship_from_store_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\": 21566.005991410428, \"DC2\": 16049.495114637843, \"DC3\": 14678.295265873165, \"DC4\": 15179.345470283368, \"DC5\": 12417.872804445959}, \"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\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC3\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC4\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC5\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0]}, \"labor_usage\": {\"SKU_Basic\": 0.5, \"SKU_Premium\": 0.8, \"SKU_ShortLife\": 0.6}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [260, 315, 284, 333, 384, 549, 750, 913, 1084, 1422, 1490, 1136, 1239, 894, 775, 547, 372, 373, 295, 349], \"SKU_Premium\": [140, 170, 167, 174, 216, 299, 402, 461, 541, 675, 576, 704, 495, 448, 384, 247, 234, 156, 163, 147], \"SKU_ShortLife\": [104, 116, 140, 161, 159, 220, 294, 350, 451, 501, 535, 469, 465, 359, 300, 238, 176, 128, 114, 128]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 386863.5} {"scenario_id": "retail_f8_ship_from_store_v4", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_ship_from_store\nScenario ID: retail_f8_ship_from_store_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nStores fulfill both walk-in traffic and online orders, effectively acting as small fulfillment centers that ship from store. Storage capacity and labor capacity at stores are scaled up, but labor usage per unit is higher when stores serve both channels. Demand from walk-in and online customers is aggregated into a single local demand stream per product and location, and unmet demand is lost and penalized.\n\nStructure cues:\n- The inventory structure is single-echelon with local demand at each location, storage capacity, and lost sales.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. Storage capacities are scaled to 5x normal values to accommodate dual-channel operations.\n- Labor capacity: The JSON provides labor_cap=500 per location per period, with higher labor_usage per product (SKU_Basic=0.5, SKU_Premium=0.8, SKU_ShortLife=0.6) reflecting the additional work from online fulfillment.\n- Stores conceptually serve two demand streams, but the model treats them as a single aggregated demand per product and location.\n- Inventory remains non-negative and is updated from previous stock and production, minus sales and waste.\n- There is no transshipment; lead times are zero, and substitution behavior remains as encoded.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) while balancing higher labor intensity against increased capacity.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_ship_from_store_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 22599.64979107614,\n \"DC2\": 19828.71384348629,\n \"DC3\": 14887.23413797763,\n \"DC4\": 13800.155656911498,\n \"DC5\": 14039.23739623958\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC2\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC3\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC4\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ],\n \"DC5\": [\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0,\n 500.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.5,\n \"SKU_Premium\": 0.8,\n \"SKU_ShortLife\": 0.6\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 309,\n 321,\n 368,\n 323,\n 499,\n 508,\n 700,\n 844,\n 970,\n 1126,\n 1482,\n 1189,\n 1145,\n 811,\n 639,\n 533,\n 469,\n 404,\n 320,\n 266\n ],\n \"SKU_Premium\": [\n 148,\n 141,\n 180,\n 165,\n 190,\n 287,\n 349,\n 405,\n 495,\n 582,\n 584,\n 550,\n 628,\n 478,\n 394,\n 307,\n 248,\n 193,\n 149,\n 136\n ],\n \"SKU_ShortLife\": [\n 127,\n 121,\n 145,\n 131,\n 185,\n 250,\n 321,\n 399,\n 445,\n 500,\n 587,\n 540,\n 458,\n 325,\n 309,\n 186,\n 149,\n 137,\n 120,\n 123\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": null\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_ship_from_store_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\": 22599.64979107614, \"DC2\": 19828.71384348629, \"DC3\": 14887.23413797763, \"DC4\": 13800.155656911498, \"DC5\": 14039.23739623958}, \"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\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC2\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC3\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC4\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0], \"DC5\": [500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0]}, \"labor_usage\": {\"SKU_Basic\": 0.5, \"SKU_Premium\": 0.8, \"SKU_ShortLife\": 0.6}, \"return_rate\": {\"SKU_Basic\": 0.0, \"SKU_Premium\": 0.0, \"SKU_ShortLife\": 0.0}, \"demand_curve\": {\"SKU_Basic\": [309, 321, 368, 323, 499, 508, 700, 844, 970, 1126, 1482, 1189, 1145, 811, 639, 533, 469, 404, 320, 266], \"SKU_Premium\": [148, 141, 180, 165, 190, 287, 349, 405, 495, 582, 584, 550, 628, 478, 394, 307, 248, 193, 149, 136], \"SKU_ShortLife\": [127, 121, 145, 131, 185, 250, 321, 399, 445, 500, 587, 540, 458, 325, 309, 186, 149, 137, 120, 123]}, \"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\": []}}", "reference_status": "OPTIMAL", "reference_objective": 372322.0} {"scenario_id": "retail_f8_sustainability_v0", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v0\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_sustainability_v0\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4000,\n \"DC2\": 3500,\n \"DC3\": 3000,\n \"DC4\": 3000,\n \"DC5\": 2500\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 303,\n 311,\n 328,\n 365,\n 435,\n 549,\n 711,\n 906,\n 1100,\n 1245,\n 1300,\n 1245,\n 1100,\n 906,\n 711,\n 549,\n 435,\n 365,\n 328,\n 311\n ],\n \"SKU_Premium\": [\n 151,\n 155,\n 164,\n 182,\n 217,\n 274,\n 355,\n 453,\n 550,\n 622,\n 650,\n 622,\n 550,\n 453,\n 355,\n 274,\n 217,\n 182,\n 164,\n 155\n ],\n \"SKU_ShortLife\": [\n 121,\n 124,\n 131,\n 146,\n 174,\n 219,\n 284,\n 362,\n 440,\n 498,\n 520,\n 498,\n 440,\n 362,\n 284,\n 219,\n 174,\n 146,\n 131,\n 124\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": 0.02\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_sustainability_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\": 0.02}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 378951.5} {"scenario_id": "retail_f8_sustainability_v1", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v1\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_sustainability_v1\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3956.5665970647583,\n \"DC2\": 3670.891167497476,\n \"DC3\": 3414.51847451406,\n \"DC4\": 2919.595530479684,\n \"DC5\": 2557.1025512044253\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 280,\n 324,\n 286,\n 327,\n 415,\n 599,\n 609,\n 820,\n 1231,\n 1278,\n 1125,\n 1113,\n 1115,\n 952,\n 713,\n 627,\n 480,\n 322,\n 279,\n 313\n ],\n \"SKU_Premium\": [\n 137,\n 171,\n 183,\n 157,\n 206,\n 298,\n 320,\n 501,\n 508,\n 704,\n 716,\n 692,\n 599,\n 496,\n 321,\n 284,\n 204,\n 181,\n 181,\n 172\n ],\n \"SKU_ShortLife\": [\n 132,\n 140,\n 117,\n 131,\n 162,\n 196,\n 292,\n 358,\n 500,\n 460,\n 535,\n 442,\n 497,\n 350,\n 324,\n 221,\n 167,\n 131,\n 123,\n 142\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": 0.02\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_sustainability_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\": 3956.5665970647583, \"DC2\": 3670.891167497476, \"DC3\": 3414.51847451406, \"DC4\": 2919.595530479684, \"DC5\": 2557.1025512044253}, \"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\": [280, 324, 286, 327, 415, 599, 609, 820, 1231, 1278, 1125, 1113, 1115, 952, 713, 627, 480, 322, 279, 313], \"SKU_Premium\": [137, 171, 183, 157, 206, 298, 320, 501, 508, 704, 716, 692, 599, 496, 321, 284, 204, 181, 181, 172], \"SKU_ShortLife\": [132, 140, 117, 131, 162, 196, 292, 358, 500, 460, 535, 442, 497, 350, 324, 221, 167, 131, 123, 142]}, \"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\": 0.02}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 388265.5} {"scenario_id": "retail_f8_sustainability_v2", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v2\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_sustainability_v2\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4351.845005463791,\n \"DC2\": 3058.9137264528454,\n \"DC3\": 3072.7274664757147,\n \"DC4\": 2622.5840718864783,\n \"DC5\": 2276.318626218026\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 328,\n 340,\n 296,\n 343,\n 486,\n 511,\n 796,\n 1029,\n 989,\n 1204,\n 1487,\n 1124,\n 1181,\n 850,\n 641,\n 477,\n 432,\n 377,\n 314,\n 329\n ],\n \"SKU_Premium\": [\n 154,\n 144,\n 175,\n 176,\n 222,\n 298,\n 302,\n 515,\n 630,\n 531,\n 644,\n 655,\n 587,\n 404,\n 318,\n 260,\n 212,\n 204,\n 181,\n 178\n ],\n \"SKU_ShortLife\": [\n 119,\n 131,\n 138,\n 133,\n 150,\n 221,\n 314,\n 319,\n 463,\n 571,\n 461,\n 485,\n 486,\n 404,\n 253,\n 212,\n 194,\n 143,\n 122,\n 122\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": 0.02\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_sustainability_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\": 4351.845005463791, \"DC2\": 3058.9137264528454, \"DC3\": 3072.7274664757147, \"DC4\": 2622.5840718864783, \"DC5\": 2276.318626218026}, \"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\": [328, 340, 296, 343, 486, 511, 796, 1029, 989, 1204, 1487, 1124, 1181, 850, 641, 477, 432, 377, 314, 329], \"SKU_Premium\": [154, 144, 175, 176, 222, 298, 302, 515, 630, 531, 644, 655, 587, 404, 318, 260, 212, 204, 181, 178], \"SKU_ShortLife\": [119, 131, 138, 133, 150, 221, 314, 319, 463, 571, 461, 485, 486, 404, 253, 212, 194, 143, 122, 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\": 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\": 0.02}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 381968.5} {"scenario_id": "retail_f8_sustainability_v3", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v3\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_sustainability_v3\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 3869.98377542635,\n \"DC2\": 3317.4833163625435,\n \"DC3\": 3284.9815973947448,\n \"DC4\": 2914.281722321398,\n \"DC5\": 2695.974507694342\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 268,\n 293,\n 288,\n 344,\n 413,\n 535,\n 814,\n 1006,\n 1169,\n 1061,\n 1339,\n 1126,\n 1167,\n 784,\n 651,\n 548,\n 455,\n 413,\n 311,\n 276\n ],\n \"SKU_Premium\": [\n 130,\n 175,\n 172,\n 183,\n 224,\n 272,\n 375,\n 483,\n 591,\n 670,\n 676,\n 581,\n 551,\n 476,\n 304,\n 235,\n 198,\n 195,\n 184,\n 151\n ],\n \"SKU_ShortLife\": [\n 123,\n 124,\n 135,\n 159,\n 165,\n 222,\n 297,\n 310,\n 411,\n 536,\n 595,\n 546,\n 495,\n 399,\n 279,\n 249,\n 191,\n 162,\n 137,\n 111\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": 0.02\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_sustainability_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\": 3869.98377542635, \"DC2\": 3317.4833163625435, \"DC3\": 3284.9815973947448, \"DC4\": 2914.281722321398, \"DC5\": 2695.974507694342}, \"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, 293, 288, 344, 413, 535, 814, 1006, 1169, 1061, 1339, 1126, 1167, 784, 651, 548, 455, 413, 311, 276], \"SKU_Premium\": [130, 175, 172, 183, 224, 272, 375, 483, 591, 670, 676, 581, 551, 476, 304, 235, 198, 195, 184, 151], \"SKU_ShortLife\": [123, 124, 135, 159, 165, 222, 297, 310, 411, 536, 595, 546, 495, 399, 279, 249, 191, 162, 137, 111]}, \"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\": 0.02}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 382648.0} {"scenario_id": "retail_f8_sustainability_v4", "prompt_schema": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA SCHEMA]\n{\n \"name\": str, # scenario identifier\n \"periods\": int, # number of time periods\n \"products\": [str, ...], # list of product IDs\n \"locations\": [str, ...], # list of location IDs\n\n \"shelf_life\": {p: int}, # shelf life in periods per product\n \"lead_time\": {p: int}, # order lead time per product (0 = same-period arrival)\n\n \"demand_curve\": {p: [float, ...]}, # demand per product per period (0-indexed list)\n \"demand_share\": {l: float}, # fraction of total demand at each location\n\n \"production_cap\": {p: [float, ...]}, # max production per product per period (0-indexed list)\n \"cold_capacity\": {l: float}, # storage capacity per location\n \"cold_usage\": {p: float}, # storage units per unit of product\n\n \"labor_cap\": {l: [float, ...]}, # labor hours per location per period (0-indexed list)\n \"labor_usage\": {p: float}, # labor hours per unit sold\n \"return_rate\": {p: float}, # fraction of sales returned next period\n\n \"costs\": {\n \"purchasing\": {p: float}, # cost per unit ordered\n \"inventory\": {p: float}, # holding cost per unit per period\n \"waste\": {p: float}, # cost per unit expired\n \"lost_sales\": {p: float}, # penalty per unit of unmet demand\n \"fixed_order\": float, # fixed cost per order placed\n \"transshipment\": float # cost per unit transshipped\n },\n\n \"constraints\": {\n \"moq\": float, # minimum order quantity (0 = no MOQ)\n \"pack_size\": int, # order must be multiple of this (1 = no constraint)\n \"budget_per_period\": float|null, # max purchasing cost per period\n \"waste_limit_pct\": float|null # max waste as fraction of total demand\n },\n\n \"network\": {\n \"sub_edges\": [[p_from, p_to], ...], # substitution: p_from's demand can be served by p_to\n \"trans_edges\": [[l_from, l_to], ...]# transshipment: can ship from l_from to l_to\n }\n}\n\n[DATA ACCESS]\n- The variable `data` is pre-loaded. Do NOT use file I/O.\n- Lists are 0-indexed (period t in model uses index [t-1] in data arrays)\n\nCRITICAL - Network edges require tuple conversion for Gurobi:\n sub_edges = [tuple(e) for e in data.get('network', {}).get('sub_edges', [])]\n trans_edges = [tuple(e) for e in data.get('network', {}).get('trans_edges', [])]\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that models and solves this optimization problem.\n", "prompt_full": "[SCENARIO]\nFamily: F8 (Omni channel and Store Operations)\nArchetype: retail_f8_sustainability\nScenario ID: retail_f8_sustainability_v4\n\n[BUSINESS DESCRIPTION]\nBusiness narrative:\nThe retailer operates under a sustainability or regulatory constraint that limits total waste. Over the entire planning horizon, the total quantity discarded as waste must not exceed a fixed fraction of total demand. Demand is local and exogenous; unmet demand is lost and penalized. The retailer must balance serving demand, avoiding stockouts, and limiting waste.\n\nStructure cues:\n- The inventory and production structure is the same single-echelon system with storage capacity and lost sales as in the base scenario.\n- Shelf life: Each product has a shelf life in periods. Inventory must be tracked by REMAINING LIFE.\n\n VARIABLE DEFINITION: I[p,l,t,r] = inventory at START of period t with r periods remaining.\n Convention: r=1 is OLDEST (sell first FIFO), r=shelf_life[p] is FRESHEST.\n\n KEY EQUATIONS - implement EXACTLY as written, do NOT add or remove terms:\n\n (1) Fresh inflow: I[p,l,t,SL] = Q[p,t] * demand_share[l]\n - This is ONLY the inflow from production. Do NOT subtract sales here!\n - Q is total production, demand_share distributes it to locations.\n\n (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\n - Inventory tomorrow with r remaining = inventory today with r+1 remaining - sales\n\n (3) Waste: W[p,l,t] = I[p,l,t,1] - sales[p,l,t,1]\n - Items with r=1 that aren't sold become waste\n\n (4) Sales availability: sales[p,l,t,r] <= I[p,l,t,r]\n - Can only sell what you have in inventory\n\n (5) Inventory holding cost: charged on (I[p,l,t,r] - sales[p,l,t,r]) for r >= 2\n - Charge on END-of-period inventory (after sales), exclude expiring items (r=1)\n- Storage capacity: sum over products of (cold_usage[p] * total_inventory[p,l,t]) <= cold_capacity[l]. These limits must be respected.\n- The JSON specifies waste_limit_pct=0.02 (2%). Over the horizon, the total waste across all products, locations, and periods must not exceed 2% of total demand: sum(waste) <= 0.02 * sum(demand).\n- Inventory is updated from previous stock and production, minus sales and waste, and remains non-negative.\n- Substitution behavior remains active as defined in the JSON, and there is no transshipment.\n- The objective is to minimize total cost (aggregating purchasing, holding, waste, and lost sales) subject to the global waste cap, making trade-offs between holding more inventory, losing sales, and discarding units explicit.\n\n[DATA]\nThe following JSON contains all instance data. Parse it directly in your code.\n\n```json\n{\n \"name\": \"retail_f8_sustainability_v4\",\n \"description\": \"Standard seasonal retail scenario.\",\n \"periods\": 20,\n \"products\": [\n \"SKU_Basic\",\n \"SKU_Premium\",\n \"SKU_ShortLife\"\n ],\n \"locations\": [\n \"DC1\",\n \"DC2\",\n \"DC3\",\n \"DC4\",\n \"DC5\"\n ],\n \"shelf_life\": {\n \"SKU_Basic\": 10,\n \"SKU_Premium\": 8,\n \"SKU_ShortLife\": 4\n },\n \"lead_time\": {\n \"SKU_Basic\": 0,\n \"SKU_Premium\": 0,\n \"SKU_ShortLife\": 0\n },\n \"cold_capacity\": {\n \"DC1\": 4093.4018715811044,\n \"DC2\": 3982.907234711066,\n \"DC3\": 2758.6197526372707,\n \"DC4\": 2886.70990311586,\n \"DC5\": 2444.9246693708806\n },\n \"cold_usage\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 1.2\n },\n \"production_cap\": {\n \"SKU_Basic\": [\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800,\n 800\n ],\n \"SKU_Premium\": [\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400,\n 400\n ],\n \"SKU_ShortLife\": [\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500,\n 500\n ]\n },\n \"labor_cap\": {\n \"DC1\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC2\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC3\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC4\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ],\n \"DC5\": [\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0,\n 99999.0\n ]\n },\n \"labor_usage\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"return_rate\": {\n \"SKU_Basic\": 0.0,\n \"SKU_Premium\": 0.0,\n \"SKU_ShortLife\": 0.0\n },\n \"demand_curve\": {\n \"SKU_Basic\": [\n 298,\n 329,\n 310,\n 402,\n 466,\n 493,\n 772,\n 978,\n 971,\n 1084,\n 1490,\n 1073,\n 1094,\n 864,\n 640,\n 468,\n 398,\n 342,\n 375,\n 300\n ],\n \"SKU_Premium\": [\n 150,\n 141,\n 169,\n 165,\n 193,\n 288,\n 365,\n 389,\n 556,\n 639,\n 567,\n 681,\n 603,\n 402,\n 380,\n 245,\n 188,\n 166,\n 182,\n 162\n ],\n \"SKU_ShortLife\": [\n 118,\n 112,\n 120,\n 143,\n 190,\n 198,\n 247,\n 336,\n 393,\n 500,\n 579,\n 437,\n 444,\n 376,\n 256,\n 205,\n 189,\n 151,\n 126,\n 111\n ]\n },\n \"demand_share\": {\n \"DC1\": 0.25,\n \"DC2\": 0.2,\n \"DC3\": 0.2,\n \"DC4\": 0.2,\n \"DC5\": 0.15\n },\n \"costs\": {\n \"lost_sales\": {\n \"SKU_Basic\": 50.0,\n \"SKU_Premium\": 80.0,\n \"SKU_ShortLife\": 40.0\n },\n \"inventory\": {\n \"SKU_Basic\": 1.0,\n \"SKU_Premium\": 1.5,\n \"SKU_ShortLife\": 1.0\n },\n \"waste\": {\n \"SKU_Basic\": 2.0,\n \"SKU_Premium\": 3.0,\n \"SKU_ShortLife\": 2.0\n },\n \"fixed_order\": 0.0,\n \"transshipment\": 0.5,\n \"purchasing\": {\n \"SKU_Basic\": 10.0,\n \"SKU_Premium\": 20.0,\n \"SKU_ShortLife\": 15.0\n }\n },\n \"constraints\": {\n \"moq\": 0,\n \"pack_size\": 1,\n \"budget_per_period\": null,\n \"waste_limit_pct\": 0.02\n },\n \"network\": {\n \"sub_edges\": [\n [\n \"SKU_Basic\",\n \"SKU_Premium\"\n ]\n ],\n \"trans_edges\": []\n }\n}\n```\n\n[OUTPUT FORMAT]\n- Import: import gurobipy as gp; from gurobipy import GRB; import json\n- Set Gurobi params: m.Params.OutputFlag = 0; m.Params.Threads = 1; m.Params.Seed = 0\n- Print at end:\n print(f\"status: {{m.Status}}\")\n if m.Status == 2:\n print(f\"objective: {{m.ObjVal}}\")\n- Output ONLY executable Python code. No markdown, no explanations.\n\n[TASK]\nWrite a GurobiPy script that:\n1. Parses the JSON data above (use json.loads on the string)\n2. Models and solves the optimization problem\n3. Prints status and objective value\n", "data": "{\"name\": \"retail_f8_sustainability_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\": 4093.4018715811044, \"DC2\": 3982.907234711066, \"DC3\": 2758.6197526372707, \"DC4\": 2886.70990311586, \"DC5\": 2444.9246693708806}, \"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\": [298, 329, 310, 402, 466, 493, 772, 978, 971, 1084, 1490, 1073, 1094, 864, 640, 468, 398, 342, 375, 300], \"SKU_Premium\": [150, 141, 169, 165, 193, 288, 365, 389, 556, 639, 567, 681, 603, 402, 380, 245, 188, 166, 182, 162], \"SKU_ShortLife\": [118, 112, 120, 143, 190, 198, 247, 336, 393, 500, 579, 437, 444, 376, 256, 205, 189, 151, 126, 111]}, \"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\": 0.02}, \"network\": {\"sub_edges\": [[\"SKU_Basic\", \"SKU_Premium\"]], \"trans_edges\": []}}", "reference_status": "OPTIMAL", "reference_objective": 367880.5}