A large-scale logistics company specializes in transporting a wide variety of perishable goods from a central distribution hub to several supermarket chains. The company uses a fleet of advanced refrigerated trucks, and for a specific delivery route, one truck needs to be loaded. Each truck has strict capacity limits in four dimensions: a maximum weight of 12 tons, a total volume of 35 m³, a refrigeration power output of 40 kW, and a total cool-down time budget of 100 hours (a proxy for the energy and time required to bring goods to their optimal temperature and maintain it).

The goods are classified into 10 distinct categories. For each category, the company can choose from 5 different variants, each sourced from a different supplier and having unique characteristics. The company must select exactly one variant from each of the 10 categories to be included in the shipment with the primary goal to maximize the total profit.

Furthermore, there are two special conditions for this delivery:
1.  Product Synergy: If Variant B of Fruits (Category 1) and Variant C of Baked Goods (Category 6) are shipped together, a special packaging collaboration creates an additional bonus profit of $150.
2.  Product Conflict: Due to the high risk of cross-contamination, shipping Variant A of Seafood (Category 5) and Variant A of Dairy (Category 3) together is forbidden.

The complete data for all available goods is as follows:

| Category | Variant | Weight (t) | Volume (m³) | Power (kW) | Cool-Down (hr) | Profit ($) |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| **1: Fruits** | A | 1.1 | 2.8 | 2.0 | 8.0 | 210 |
| | B | 1.3 | 3.2 | 2.5 | 10.0 | 290 |
| | C | 0.9 | 2.4 | 1.8 | 7.0 | 190 |
| | D | 1.4 | 3.5 | 2.8 | 11.0 | 320 |
| | E | 1.0 | 2.6 | 1.9 | 7.5 | 200 |
| **2: Vegetables** | A | 0.8 | 2.0 | 1.0 | 5.0 | 160 |
| | B | 1.0 | 2.5 | 1.5 | 6.0 | 230 |
| | C | 0.7 | 1.8 | 0.9 | 4.5 | 140 |
| | D | 1.2 | 2.8 | 1.8 | 7.0 | 260 |
| | E | 0.9 | 2.2 | 1.2 | 5.5 | 190 |
| **3: Dairy** | A | 1.5 | 4.5 | 4.2 | 12.0 | 360 |
| | B | 1.3 | 4.0 | 3.5 | 10.0 | 310 |
| | C | 1.7 | 5.0 | 4.8 | 14.0 | 420 |
| | D | 1.4 | 4.2 | 3.8 | 11.0 | 340 |
| | E | 1.6 | 4.8 | 4.5 | 13.0 | 400 |
| **4: Meat** | A | 1.9 | 4.0 | 6.5 | 15.0 | 520 |
| | B | 1.6 | 3.5 | 5.5 | 13.0 | 460 |
| | C | 2.1 | 4.5 | 7.2 | 17.0 | 580 |
| | D | 1.8 | 3.8 | 6.0 | 14.0 | 500 |
| | E | 2.2 | 4.8 | 7.5 | 18.0 | 600 |
| **5: Seafood** | A | 1.4 | 3.0 | 8.0 | 16.0 | 480 |
| | B | 1.2 | 2.8 | 7.0 | 14.0 | 430 |
| | C | 1.6 | 3.5 | 9.0 | 18.0 | 550 |
| | D | 1.3 | 2.9 | 7.5 | 15.0 | 450 |
| | E | 1.7 | 3.8 | 9.5 | 19.0 | 590 |
| **6: Baked Goods**| A | 0.5 | 1.5 | 0.5 | 2.0 | 90 |
| | B | 0.7 | 2.0 | 0.8 | 3.0 | 140 |
| | C | 0.6 | 1.8 | 0.6 | 2.5 | 120 |
| | D | 0.8 | 2.2 | 1.0 | 3.5 | 160 |
| | E | 0.4 | 1.2 | 0.4 | 1.5 | 80 |
| **7: Beverages** | A | 1.8 | 3.0 | 1.5 | 4.0 | 250 |
| | B | 2.0 | 3.5 | 1.8 | 5.0 | 290 |
| | C | 1.6 | 2.8 | 1.4 | 3.5 | 220 |
| | D | 2.2 | 3.8 | 2.0 | 6.0 | 330 |
| | E | 1.7 | 2.9 | 1.6 | 4.5 | 240 |
| **8: Frozen** | A | 2.0 | 5.0 | 8.0 | 20.0 | 500 |
| | B | 1.8 | 4.5 | 7.0 | 18.0 | 450 |
| | C | 2.3 | 5.5 | 9.0 | 22.0 | 580 |
| | D | 2.1 | 5.2 | 8.5 | 21.0 | 540 |
| | E | 2.5 | 6.0 | 9.8 | 24.0 | 620 |
| **9: Deli Meats** | A | 0.9 | 2.0 | 3.0 | 6.0 | 180 |
| | B | 1.1 | 2.5 | 3.5 | 7.0 | 240 |
| | C | 0.8 | 1.8 | 2.8 | 5.5 | 160 |
| | D | 1.2 | 2.8 | 4.0 | 8.0 | 270 |
| | E | 1.0 | 2.2 | 3.2 | 6.5 | 210 |
| **10: Prepared** | A | 1.3 | 3.0 | 4.0 | 9.0 | 300 |
| | B | 1.5 | 3.5 | 4.5 | 10.0 | 350 |
| | C | 1.2 | 2.8 | 3.8 | 8.0 | 280 |
| | D | 1.6 | 3.8 | 5.0 | 11.0 | 380 |
| | E | 1.4 | 3.2 | 4.2 | 9.5 | 330 |

Problem type: ILP (Medium: 51 variables, 18 constraints, 259 nonzeros)

Mathematical model:
Sets:
1.  Categories C: The set of product categories, C = {1, 2, ..., 10}.
2.  Variants Vc: The set of variants for each category c in C, Vc = {A, B, C, D, E}.

Parameters:
1.  Resource Limits:
    WeightLimit = 12 (tons)
    VolumeLimit = 35 (m³)
    PowerLimit = 40 (kW)
    TimeLimit = 100 (hours)
2.  Product Data: For each c in C, v in Vc:
    Weight_cv: Weight of variant v in category c.
    Volume_cv: Volume of variant v in category c.
    Power_cv: Power consumption of variant v in category c.
    Time_cv: Cool-down time for variant v in category c.
    Profit_cv: Profit of variant v in category c.
3.  Synergy Bonus:
    BonusProfit = 150

Decision Variables:
1.  Primary Selection x_cv: A binary variable, where x_cv = 1 if variant v from category c is selected, and 0 otherwise.
2.  Synergy Indicator y: A binary variable, where y = 1 if the specific synergistic combination of products is selected, and 0 otherwise.

Objective Function:
Maximize the total profit, which includes the base profit from all selected items plus any synergy bonuses.

Maximize Z = ( sum_{c in C} sum_{v in Vc} Profit_cv * x_cv ) + (BonusProfit * y)

Constraints:
1.  Unique Selection per Category: Exactly one variant must be chosen from each category.
    sum_{v in Vc} x_cv = 1, for all c in C
2.  Weight Capacity: The total weight of selected variants must not exceed the truck's limit.
    sum_{c in C} sum_{v in Vc} Weight_cv * x_cv <= WeightLimit
3.  Volume Capacity: The total volume of selected variants must not exceed the truck's limit.
    sum_{c in C} sum_{v in Vc} Volume_cv * x_cv <= VolumeLimit
4.  Power Capacity: The total refrigeration power required must not exceed the truck's limit.
    sum_{c in C} sum_{v in Vc} Power_cv * x_cv <= PowerLimit
5.  Cool-Down Time Capacity: The total cool-down time required must not exceed the truck's budget.
    sum_{c in C} sum_{v in Vc} Time_cv * x_cv <= TimeLimit
6.  Product Synergy: The synergy bonus variable y can only be 1 if both Fruit Variant B (1,B) and Baked Good Variant C (6,C) are selected.
    x_{1,B} + x_{6,C} - 2y >= 0
    y <= x_{1,B}
    y <= x_{6,C}
7.  Product Conflict: The combination of Seafood Variant A (5,A) and Dairy Variant A (3,A) is forbidden.
    x_{5,A} + x_{3,A} <= 1

Type:
Binary, Linear, Linear
ILP

Gurobi implementation:
import gurobipy as gp
from gurobipy import GRB


def solve_large_scale_transport_problem(
    categories={
        1: "Fruits", 2: "Vegetables", 3: "Dairy", 4: "Meat", 5: "Seafood",
        6: "Baked Goods", 7: "Beverages", 8: "Frozen", 9: "Deli Meats", 10: "Prepared"
    },
    variants=['A', 'B', 'C', 'D', 'E'],
    weight_limit=12.0,
    volume_limit=35.0,
    power_limit=40.0,
    time_limit=100.0,
    bonus_profit=150,
    data={
        1: {'A': [1.1, 2.8, 2.0, 8, 210], 'B': [1.3, 3.2, 2.5, 10, 290], 'C': [0.9, 2.4, 1.8, 7, 190], 'D': [1.4, 3.5, 2.8, 11, 320], 'E': [1.0, 2.6, 1.9, 7.5, 200]},
        2: {'A': [0.8, 2.0, 1.0, 5, 160], 'B': [1.0, 2.5, 1.5, 6, 230], 'C': [0.7, 1.8, 0.9, 4.5, 140], 'D': [1.2, 2.8, 1.8, 7, 260], 'E': [0.9, 2.2, 1.2, 5.5, 190]},
        3: {'A': [1.5, 4.5, 4.2, 12, 360], 'B': [1.3, 4.0, 3.5, 10, 310], 'C': [1.7, 5.0, 4.8, 14, 420], 'D': [1.4, 4.2, 3.8, 11, 340], 'E': [1.6, 4.8, 4.5, 13, 400]},
        4: {'A': [1.9, 4.0, 6.5, 15, 520], 'B': [1.6, 3.5, 5.5, 13, 460], 'C': [2.1, 4.5, 7.2, 17, 580], 'D': [1.8, 3.8, 6.0, 14, 500], 'E': [2.2, 4.8, 7.5, 18, 600]},
        5: {'A': [1.4, 3.0, 8.0, 16, 480], 'B': [1.2, 2.8, 7.0, 14, 430], 'C': [1.6, 3.5, 9.0, 18, 550], 'D': [1.3, 2.9, 7.5, 15, 450], 'E': [1.7, 3.8, 9.5, 19, 590]},
        6: {'A': [0.5, 1.5, 0.5, 2, 90], 'B': [0.7, 2.0, 0.8, 3, 140], 'C': [0.6, 1.8, 0.6, 2.5, 120], 'D': [0.8, 2.2, 1.0, 3.5, 160], 'E': [0.4, 1.2, 0.4, 1.5, 80]},
        7: {'A': [1.8, 3.0, 1.5, 4, 250], 'B': [2.0, 3.5, 1.8, 5, 290], 'C': [1.6, 2.8, 1.4, 3.5, 220], 'D': [2.2, 3.8, 2.0, 6, 330], 'E': [1.7, 2.9, 1.6, 4.5, 240]},
        8: {'A': [2.0, 5.0, 8.0, 20, 500], 'B': [1.8, 4.5, 7.0, 18, 450], 'C': [2.3, 5.5, 9.0, 22, 580], 'D': [2.1, 5.2, 8.5, 21, 540], 'E': [2.5, 6.0, 9.8, 24, 620]},
        9: {'A': [0.9, 2.0, 3.0, 6, 180], 'B': [1.1, 2.5, 3.5, 7, 240], 'C': [0.8, 1.8, 2.8, 5.5, 160], 'D': [1.2, 2.8, 4.0, 8, 270], 'E': [1.0, 2.2, 3.2, 6.5, 210]},
        10: {'A': [1.3, 3.0, 4.0, 9, 300], 'B': [1.5, 3.5, 4.5, 10, 350], 'C': [1.2, 2.8, 3.8, 8, 280], 'D': [1.6, 3.8, 5.0, 11, 380], 'E': [1.4, 3.2, 4.2, 9.5, 330]}
    }
):
    """
    Solves the large-scale, multi-constraint perishable goods
    transportation problem using Gurobi.
    """
    # Create a new model
    model = gp.Model("LargeScalePerishableTransport")

    # --- Decision Variables ---
    x = model.addVars(data.keys(), variants, vtype=GRB.BINARY, name="x")
    y = model.addVar(vtype=GRB.BINARY, name="SynergyBonus")

    # --- Objective Function ---
    base_profit = gp.quicksum(data[c][v][4] * x[c, v] for c in data for v in variants)
    total_profit = base_profit + (bonus_profit * y)
    model.setObjective(total_profit, GRB.MAXIMIZE)

    # --- Constraints ---
    for c in data:
        model.addConstr(gp.quicksum(x[c, v] for v in variants) == 1, name=f"SelectOne_{c}")

    model.addConstr(gp.quicksum(data[c][v][0] * x[c, v] for c in data for v in variants) <= weight_limit, "WeightLimit")
    model.addConstr(gp.quicksum(data[c][v][1] * x[c, v] for c in data for v in variants) <= volume_limit, "VolumeLimit")
    model.addConstr(gp.quicksum(data[c][v][2] * x[c, v] for c in data for v in variants) <= power_limit, "PowerLimit")
    model.addConstr(gp.quicksum(data[c][v][3] * x[c, v] for c in data for v in variants) <= time_limit, "TimeLimit")

    model.addConstr(y <= x[1, 'B'], "SynergyCheck1")
    model.addConstr(y <= x[6, 'C'], "SynergyCheck2")
    model.addConstr(y >= x[1, 'B'] + x[6, 'C'] - 1, "SynergyActivation")

    model.addConstr(x[5, 'A'] + x[3, 'A'] <= 1, "ProductConflict")

    # --- Solve ---
    model.optimize()

    # --- Return Results ---
    if model.status == GRB.OPTIMAL:
        return {"status": "optimal", "obj": model.ObjVal}
    else:
        return {"status": f"{model.status}"}


if __name__ == "__main__":
    result = solve_large_scale_transport_problem()
    print(result)


Solution status: OPTIMAL
Optimal objective value: 2880